Add support to download Lattice's FPGA
Subsystems (2)
This patch incorporates the Lattice's tool ispVM EMBEDDED (see http://www.latticesemi.com) to download a new bitstream to Lattice's FPGA using using the commands "fpga load" already provided by u-boot.
The file to be downloaded must be converted in binary format from the original SVF file. Documentation is provided inside the ispVM Tools.
PATCH 1/3 FPGA: add support for downloading Lattice bitstream
The patch adds support to load a Lattice's bitstream image (called VME file) into a Lattice FPGA. The code containing the state machine delivered as part of Lattice's ispVMtools is integrated.
The FPGA is programmed using the JTAG interface. The board maintainer must provide accessors to drive the JTAG signals TCK, TMS, TDI and to get the value of the input signal TDO.
--- drivers/fpga/Makefile | 1 + drivers/fpga/fpga.c | 11 + drivers/fpga/ivm_core.c | 3166 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/fpga/lattice.c | 399 ++++++ include/fpga.h | 1 + include/lattice.h | 317 +++++ 6 files changed, 3895 insertions(+), 0 deletions(-) create mode 100755 drivers/fpga/ivm_core.c create mode 100644 drivers/fpga/lattice.c create mode 100755 include/lattice.h
drivers/fpga/Makefile +1 -0
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_FPGA_SPARTAN2) += spartan2.o COBJS-$(CONFIG_FPGA_SPARTAN3) += spartan3.o COBJS-$(CONFIG_FPGA_VIRTEX2) += virtex2.o COBJS-$(CONFIG_FPGA_XILINX) += xilinx.o +COBJS-$(CONFIG_FPGA_LATTICE) += ivm_core.o lattice.o ifdef CONFIG_FPGA_ALTERA COBJS-y += altera.o COBJS-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o
drivers/fpga/fpga.c +11 -0
@@ -28,6 +28,7 @@#include <common.h> /* core U-Boot definitions */ #include <xilinx.h> /* xilinx specific definitions */ #include <altera.h> /* altera specific definitions */ +#include <lattice.h> #if 0 #define FPGA_DEBUG /* define FPGA_DEBUG to get debug messages */
@@ -139,6 +140,10 @@ static int fpga_dev_info( int devnum )fpga_no_sup ( (char *)__FUNCTION__,"Altera devices" );#endif break ; +case fpga_lattice: +printf ("Lattice Device\nDescriptor @ 0x%p\n" , desc); + ret_val =lattice_info (desc->devdesc); +break ;default :printf ("%s: Invalid or unsupported device type %d\n" , __FUNCTION__, desc->devtype );
@@ -224,6 +229,9 @@ int fpga_load( int devnum, void *buf, size_t bsize )fpga_no_sup ( (char *)__FUNCTION__,"Altera devices" );#endif break ; +case fpga_lattice: + ret_val =lattice_load (desc->devdesc, buf, bsize); +break ;default :printf ("%s: Invalid or unsupported device type %d\n" , __FUNCTION__, desc->devtype );
@@ -257,6 +265,9 @@ int fpga_dump( int devnum, void *buf, size_t bsize )fpga_no_sup ( (char *)__FUNCTION__,"Altera devices" );#endif break ; +case fpga_lattice: + ret_val =lattice_dump (desc->devdesc, buf, bsize); +break ;default :printf ("%s: Invalid or unsupported device type %d\n" , __FUNCTION__, desc->devtype );
drivers/fpga/ivm_core.c new file +3166 -0
2,958 lines not on this page · raw message
drivers/fpga/lattice.c new file +399 -0
399 lines not on this page · raw message
include/lattice.h new file +317 -0
317 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.6.3.3
Part of the diff is not shown here. View the raw message.
PATCH 2/3 MX31: Adding missing iomux pin to MX.31 registers
--- arch/arm/include/asm/arch-mx31/mx31-regs.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-mx31/mx31-regs.h +7 -0
@@ -214,6 +214,10 @@ struct gpio_regs {#define MUX_CTL_CSPI1_MISO 0x8d#define MUX_CTL_CSPI1_SS0 0x8e#define MUX_CTL_CSPI1_SS1 0x8f +#define MUX_CTL_STXD6 0x90 +#define MUX_CTL_SRXD6 0x91 +#define MUX_CTL_SCK6 0x92 +#define MUX_CTL_SFS6 0x93#define MUX_CTL_NFC_WP 0xD0#define MUX_CTL_NFC_CE 0xD1
@@ -224,6 +228,9 @@ struct gpio_regs {#define MUX_CTL_NFC_CLE 0xD7 +#define MUX_CTL_CAPTURE 0x150 +#define MUX_CTL_COMPARE 0x151 +/* * Helper macros for the MUX_[contact name]__[pin function] macros */
Signature · 1 line
1.6.3.3
PATCH 3/3 MX31: Add support to update FPGA bitstream
The patch adds the possibility to update the QONG FPGA (a Lattice XP2-5E) with u-boot using some GPIOs to drive the JTAG interface.
--- board/davedenx/qong/Makefile | 2 +- board/davedenx/qong/fpga.c | 95 +++++++++++++++++++++++++++++++++++++++ board/davedenx/qong/qong.c | 11 +++++ board/davedenx/qong/qong_fpga.h | 3 +- include/configs/qong.h | 3 + 5 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 board/davedenx/qong/fpga.c
board/davedenx/qong/Makefile +1 -1
@@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := qong.o +COBJS := qong.o fpga.o SOBJS := lowlevel_init.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
board/davedenx/qong/fpga.c new file +95 -0
95 lines not on this page · raw message
board/davedenx/qong/qong.c +11 -0
@@ -73,6 +73,15 @@ int board_early_init_f (void)/* set interrupt pin as input */ mxc_gpio_direction (QONG_FPGA_IRQ_PIN ,MXC_GPIO_DIRECTION_IN ); +/* FPGA JTAG Interface */ +mx31_gpio_mux (IOMUX_MODE (MUX_CTL_SFS6 ,MUX_CTL_GPIO )); +mx31_gpio_mux (IOMUX_MODE (MUX_CTL_SCK6 ,MUX_CTL_GPIO )); +mx31_gpio_mux (IOMUX_MODE (MUX_CTL_CAPTURE ,MUX_CTL_GPIO )); +mx31_gpio_mux (IOMUX_MODE (MUX_CTL_COMPARE ,MUX_CTL_GPIO )); +mxc_gpio_direction (QONG_FPGA_TCK_PIN ,MXC_GPIO_DIRECTION_OUT ); +mxc_gpio_direction (QONG_FPGA_TMS_PIN ,MXC_GPIO_DIRECTION_OUT ); +mxc_gpio_direction (QONG_FPGA_TDI_PIN ,MXC_GPIO_DIRECTION_OUT ); +mxc_gpio_direction (QONG_FPGA_TDO_PIN ,MXC_GPIO_DIRECTION_IN );#endif /* setup pins for UART1 */
@@ -146,6 +155,8 @@ int board_init (void) gd->bd->bi_arch_number =MACH_TYPE_QONG ; gd->bd->bi_boot_params = (0x80000100 );/* adress of boot parameters */ +qong_fpga_init (); +return 0 ; }
board/davedenx/qong/qong_fpga.h +1 -2
@@ -24,7 +24,6 @@#ifndef QONG_FPGA_H #define QONG_FPGA_H -#ifdef CONFIG_QONG_FPGA #define QONG_FPGA_CTRL_BASE CONFIG_FPGA_BASE#define QONG_FPGA_CTRL_VERSION (QONG_FPGA_CTRL_BASE + 0x00000000)#define QONG_FPGA_PERIPH_SIZE (1 << 24)
@@ -35,6 +34,6 @@#define QONG_FPGA_TDO_PIN 7#define QONG_FPGA_RST_PIN 48#define QONG_FPGA_IRQ_PIN 40 -#endif +int qong_fpga_init (void );#endif /* QONG_FPGA_H */
include/configs/qong.h +3 -0
@@ -66,8 +66,11 @@#define CONFIG_FSL_PMIC_MODE (SPI_MODE_2 | SPI_CS_HIGH)/* FPGA */ +#define CONFIG_FPGA #define CONFIG_QONG_FPGA 1#define CONFIG_FPGA_BASE (CS1_BASE) +#define CONFIG_FPGA_LATTICE +#define CONFIG_FPGA_COUNT 1#ifdef CONFIG_QONG_FPGA /* Ethernet */
Signature · 1 line
1.6.3.3
PATCH 1/3 FPGA: add support for downloading Lattice bitstream
In reply to Stefano BabicDear Stefano Babic,
Quoted 9 lines · In message <[email protected]> you wrote:
The patch adds support to load a Lattice's bitstream image (called VME file) into a Lattice FPGA. The code containing the state machine delivered as part of Lattice's ispVMtools is integrated.
The FPGA is programmed using the JTAG interface. The board maintainer must provide accessors to drive the JTAG signals TCK, TMS, TDI and to get the value of the input signal TDO.
...
Quoted 6 lines
drivers/fpga/ivm_core.c new file +0
-0
drivers/fpga/ivm_core.c line 8
Quoted 8 lines
drivers/fpga/ivm_core.c new file +8
-0@@ -0,0 +1,3166 @@ +/* +* (C) Copyright 2010 +* Stefano Babic, DENX Software Engineering, sbabic at denx.de. +* +* Porting to u-boot of Lattice ispVME Embedded to +* load Lattice's FPGA: +* +* Copyright 2009 Lattice Semiconductor Corp.
I read this such that Lattice Semiconductor did the porting to U-Boot, but is this correct? I though you did that? In that case you probably want to write something like:
Porting to U-Boot:
(C) Copyright 2010
Stefano Babic, DENX Software Engineering, sbabic at denx.de.
Lattice ispVME Embedded code to load Lattice's FPGA:
Copyright 2009 Lattice Semiconductor Corp.
or so?
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Any time things appear to be going better, you have overlooked some- thing.
PATCH 1/3 FPGA: add support for downloading Lattice bitstream
Quoted 2 lines · Wolfgang Denk
Dear Stefano Babic,
Hi Wolfgang,
Quoted 16 lines
drivers/fpga/ivm_core.c line 8
Quoted 9 lines
drivers/fpga/ivm_core.c new file +8
-0@@ -0,0 +1,3166 @@ +/* +* (C) Copyright 2010 +* Stefano Babic, DENX Software Engineering, sbabic at denx.de. +* +* Porting to u-boot of Lattice ispVME Embedded to +* load Lattice's FPGA: +* +* Copyright 2009 Lattice Semiconductor Corp. I read this such that Lattice Semiconductor did the porting to U-Boot, but is this correct? I though you did that? In that case you probably want to write something like:
Porting to U-Boot:
Quoted 8 lines
(C) Copyright 2010
Stefano Babic, DENX Software Engineering, sbabic at denx.de.Lattice ispVME Embedded code to load Lattice's FPGA:
Copyright 2009 Lattice Semiconductor Corp.
or so?
That is correct. I wanted only to state that the original code comes from Lattice, but I was not clear enough in the statement. I will post the patch again ;-)
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH 1/3 FPGA: add support for downloading Lattice bitstream
In reply to Stefano BabicThe patch adds support to load a Lattice's bitstream image (called VME file) into a Lattice FPGA. The code containing the state machine delivered as part of Lattice's ispVMtools is integrated.
The FPGA is programmed using the JTAG interface. The board maintainer must provide accessors to drive the JTAG signals TCK, TMS, TDI and to get the value of the input signal TDO.
--- drivers/fpga/Makefile | 1 + drivers/fpga/fpga.c | 11 + drivers/fpga/ivm_core.c | 3167 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/fpga/lattice.c | 399 ++++++ include/fpga.h | 1 + include/lattice.h | 319 +++++ 6 files changed, 3898 insertions(+), 0 deletions(-) create mode 100755 drivers/fpga/ivm_core.c create mode 100644 drivers/fpga/lattice.c create mode 100755 include/lattice.h
drivers/fpga/Makefile +1 -0
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_FPGA_SPARTAN2) += spartan2.o COBJS-$(CONFIG_FPGA_SPARTAN3) += spartan3.o COBJS-$(CONFIG_FPGA_VIRTEX2) += virtex2.o COBJS-$(CONFIG_FPGA_XILINX) += xilinx.o +COBJS-$(CONFIG_FPGA_LATTICE) += ivm_core.o lattice.o ifdef CONFIG_FPGA_ALTERA COBJS-y += altera.o COBJS-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o
drivers/fpga/fpga.c +11 -0
@@ -28,6 +28,7 @@#include <common.h> /* core U-Boot definitions */ #include <xilinx.h> /* xilinx specific definitions */ #include <altera.h> /* altera specific definitions */ +#include <lattice.h> #if 0 #define FPGA_DEBUG /* define FPGA_DEBUG to get debug messages */
@@ -139,6 +140,10 @@ static int fpga_dev_info( int devnum )fpga_no_sup ( (char *)__FUNCTION__,"Altera devices" );#endif break ; +case fpga_lattice: +printf ("Lattice Device\nDescriptor @ 0x%p\n" , desc); + ret_val =lattice_info (desc->devdesc); +break ;default :printf ("%s: Invalid or unsupported device type %d\n" , __FUNCTION__, desc->devtype );
@@ -224,6 +229,9 @@ int fpga_load( int devnum, void *buf, size_t bsize )fpga_no_sup ( (char *)__FUNCTION__,"Altera devices" );#endif break ; +case fpga_lattice: + ret_val =lattice_load (desc->devdesc, buf, bsize); +break ;default :printf ("%s: Invalid or unsupported device type %d\n" , __FUNCTION__, desc->devtype );
@@ -257,6 +265,9 @@ int fpga_dump( int devnum, void *buf, size_t bsize )fpga_no_sup ( (char *)__FUNCTION__,"Altera devices" );#endif break ; +case fpga_lattice: + ret_val =lattice_dump (desc->devdesc, buf, bsize); +break ;default :printf ("%s: Invalid or unsupported device type %d\n" , __FUNCTION__, desc->devtype );
drivers/fpga/ivm_core.c new file +3167 -0
2,958 lines not on this page · raw message
drivers/fpga/lattice.c new file +399 -0
399 lines not on this page · raw message
include/lattice.h new file +319 -0
319 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.6.3.3
Part of the diff is not shown here. View the raw message.
PATCH v2 1/3 FPGA: add support for downloading Lattice bitstream
In reply to Stefano BabicThe patch adds support to load a Lattice's bitstream image (called VME file) into a Lattice FPGA. The code containing the state machine delivered as part of Lattice's ispVMtools is integrated.
The FPGA is programmed using the JTAG interface. The board maintainer must provide accessors to drive the JTAG signals TCK, TMS, TDI and to get the value of the input signal TDO.
---
Changes since V1:
- corrected copyright notices
drivers/fpga/Makefile | 1 + drivers/fpga/fpga.c | 11 + drivers/fpga/ivm_core.c | 3167 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/fpga/lattice.c | 399 ++++++ include/fpga.h | 1 + include/lattice.h | 319 +++++ 6 files changed, 3898 insertions(+), 0 deletions(-) create mode 100755 drivers/fpga/ivm_core.c create mode 100644 drivers/fpga/lattice.c create mode 100755 include/lattice.h
drivers/fpga/Makefile +1 -0
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_FPGA_SPARTAN2) += spartan2.o COBJS-$(CONFIG_FPGA_SPARTAN3) += spartan3.o COBJS-$(CONFIG_FPGA_VIRTEX2) += virtex2.o COBJS-$(CONFIG_FPGA_XILINX) += xilinx.o +COBJS-$(CONFIG_FPGA_LATTICE) += ivm_core.o lattice.o ifdef CONFIG_FPGA_ALTERA COBJS-y += altera.o COBJS-$(CONFIG_FPGA_ACEX1K) += ACEX1K.o
drivers/fpga/fpga.c +11 -0
@@ -28,6 +28,7 @@#include <common.h> /* core U-Boot definitions */ #include <xilinx.h> /* xilinx specific definitions */ #include <altera.h> /* altera specific definitions */ +#include <lattice.h> #if 0 #define FPGA_DEBUG /* define FPGA_DEBUG to get debug messages */
@@ -139,6 +140,10 @@ static int fpga_dev_info( int devnum )fpga_no_sup ( (char *)__FUNCTION__,"Altera devices" );#endif break ; +case fpga_lattice: +printf ("Lattice Device\nDescriptor @ 0x%p\n" , desc); + ret_val =lattice_info (desc->devdesc); +break ;default :printf ("%s: Invalid or unsupported device type %d\n" , __FUNCTION__, desc->devtype );
@@ -224,6 +229,9 @@ int fpga_load( int devnum, void *buf, size_t bsize )fpga_no_sup ( (char *)__FUNCTION__,"Altera devices" );#endif break ; +case fpga_lattice: + ret_val =lattice_load (desc->devdesc, buf, bsize); +break ;default :printf ("%s: Invalid or unsupported device type %d\n" , __FUNCTION__, desc->devtype );
@@ -257,6 +265,9 @@ int fpga_dump( int devnum, void *buf, size_t bsize )fpga_no_sup ( (char *)__FUNCTION__,"Altera devices" );#endif break ; +case fpga_lattice: + ret_val =lattice_dump (desc->devdesc, buf, bsize); +break ;default :printf ("%s: Invalid or unsupported device type %d\n" , __FUNCTION__, desc->devtype );
drivers/fpga/ivm_core.c new file +3167 -0
2,958 lines not on this page · raw message
drivers/fpga/lattice.c new file +399 -0
399 lines not on this page · raw message
include/lattice.h new file +319 -0
319 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.6.3.3
Part of the diff is not shown here. View the raw message.
PATCH 1/1 FPGA: fix support for non-Lattice devices
In reply to Stefano BabicCommit 3b8ac464 "FPGA: add support for downloading Lattice bitstream" added support for Lattice devices, but failed to add #ifdef's that are needed when building for non-Lattice devices, which results in build failures like these:
Configuring for GEN860T board...
drivers/fpga/libfpga.a(fpga.o): In function `fpga_dev_info':/home/wd/git/u-boot/work/drivers/fpga/fpga.c:145: undefined reference to lattice_info' drivers/fpga/libfpga.a(fpga.o): In function fpga_dump':/home/wd/git/u-boot/work/drivers/fpga/fpga.c:269: undefined reference to lattice_dump' drivers/fpga/libfpga.a(fpga.o): In function fpga_load':/home/wd/git/u-boot/work/drivers/fpga/fpga.c:233: undefined reference to `lattice_load'
make: *** [u-boot] Error 1
Add the missing code.
--- drivers/fpga/fpga.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/fpga/fpga.c +12 -0
@@ -141,8 +141,12 @@ static int fpga_dev_info( int devnum )#endif break ;case fpga_lattice: +#if defined(CONFIG_FPGA_LATTICE )printf ("Lattice Device\nDescriptor @ 0x%p\n" , desc); ret_val =lattice_info (desc->devdesc); +#else +fpga_no_sup ( (char *)__FUNCTION__,"Lattice devices" ); +#endif break ;default : printf( "%s: Invalid or unsupported device type %d\n",
@@ -230,7 +234,11 @@ int fpga_load( int devnum, void *buf, size_t bsize )#endif break ;case fpga_lattice: +#if defined(CONFIG_FPGA_LATTICE ) ret_val =lattice_load (desc->devdesc, buf, bsize); +#else +fpga_no_sup ( (char *)__FUNCTION__,"Lattice devices" ); +#endif break ;default : printf( "%s: Invalid or unsupported device type %d\n",
@@ -266,7 +274,11 @@ int fpga_dump( int devnum, void *buf, size_t bsize )#endif break ;case fpga_lattice: +#if defined(CONFIG_FPGA_LATTICE ) ret_val =lattice_dump (desc->devdesc, buf, bsize); +#else +fpga_no_sup ( (char *)__FUNCTION__,"Lattice devices" ); +#endif break ;default : printf( "%s: Invalid or unsupported device type %d\n",
Signature · 1 line
1.7.2.3
Wolfgang Denk
AppliedPATCH 1/1 FPGA: fix support for non-Lattice devices
Quoted 14 lines · In message <[email protected]> I wrote:
Commit
3b8ac464"FPGA: add support for downloading Lattice bitstream" added support for Lattice devices, but failed to add #ifdef's that are needed when building for non-Lattice devices, which results in build failures like these:Configuring for GEN860T board...
drivers/fpga/libfpga.a(fpga.o): In function `fpga_dev_info':/home/wd/git/u-boot/work/drivers/fpga/fpga.c:145: undefined reference tolattice_info' drivers/fpga/libfpga.a(fpga.o): In functionfpga_dump':/home/wd/git/u-boot/work/drivers/fpga/fpga.c:269: undefined reference tolattice_dump' drivers/fpga/libfpga.a(fpga.o): In functionfpga_load':/home/wd/git/u-boot/work/drivers/fpga/fpga.c:233: undefined reference to `lattice_load'
make: *** [u-boot] Error 1
Quoted 7 lines
Add the missing code.
Signed-off-by Wolfgang Denk <[email protected]>Cc Stefano Babic <[email protected]>--- drivers/fpga/fpga.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
Applied.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
PoB = "Prisoner of Bill" -- those held captive, unwillingly or other-
wise, by the contemptible Microsoft monopoly.
-- Tom Christiansen in <[email protected]>