Skip to contentSkip to conversation

FPGA cleanup + zynq support

PATCH New Michal Simek 2 participants 11 messages May 3, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover FPGA cleanup + zynq support

Fpga code is pretty old and none has tried to clean it up. My attempt is related to new code I want to push to mainline which is add support for checking bitstream and if bitstream is valid for the selected device.
For this I need to do cleanup code and move code from cmd_fpga.c to fpga.c in driver folder.

Zynq driver:
Depends on previous zynq patches sent some days ago.

Tested by:
set fload tftp \${addr} fpga.bin\;fpga info 0\;fpga load 0 \${addr} \${filesize} set floadb tftp \${addr} download.bit\;fpga info 0\;fpga loadb 0 \${addr} \${filesize} set addr 10000000
run fload
run floadb
set addr 10000001
run fload
run floadb
set addr 10000002
run fload
run floadb
set addr 10000003
run fload
run floadb

Thanks for your comments,
Michal

Changes in v3:
- Setup fpga_loadbitstream as weak function
- New patch in this series
- Rebase because of change in previous patch
- fpga_validate should be global function
- fix one printf function
- change parameter name according to previous patch dev->devnum
- New patch in this series

Changes in v2:
- Fix compilation warnings
- Fix grammer in the commit message
- Fix bugs reported by Tom Rini
- Fix checkpatch warnings (fpga)
- Fix comments (fpga)
- Do not use CamelCase for XilinxZynq (fpga)
- Move to fpga series and extend this driver
- New patch in this series

Michal Simek (9):
fpga: Clean coding style
fpga: Fix debug message compilation error
cmd: fpga: Clean coding style
cmd: fpga: Move fpga_loadbitstream to fpga.c
fpga: Change the first parameter in fpga_loadbitstream
cmd: fpga: Do not include net.h
fpga: zynq: Add support for loading bitstream
fpga: Check device name against bitstream name
fpga: Remove all CONFIG_SYS_* fpga related options

 arch/arm/cpu/armv7/zynq/slcr.c             |  35 +++
 arch/arm/include/asm/arch-zynq/hardware.h  |  10 +-
 arch/arm/include/asm/arch-zynq/sys_proto.h |   3 +
 board/xilinx/zynq/board.c                  |  37 +++
 common/cmd_fpga.c                          | 254 +++++++--------------
 drivers/fpga/Makefile                      |   1 +
 drivers/fpga/fpga.c                        | 225 +++++++++---------
 drivers/fpga/xilinx.c                      | 146 ++++++++++++
 drivers/fpga/zynqpl.c                      | 355 +++++++++++++++++++++++++++++
 include/altera.h                           |  17 --
 include/configs/M54455EVB.h                |   2 +-
 include/configs/MERGERBOX.h                |   2 +-
 include/configs/MVBC_P.h                   |   2 +-
 include/configs/MVBLM7.h                   |   2 +-
 include/configs/MVSMR.h                    |   2 +-
 include/configs/omap3_mvblx.h              |   2 +-
 include/configs/zynq.h                     |   6 +
 include/fpga.h                             |  13 +-
 include/lattice.h                          |   3 -
 include/xilinx.h                           |  25 +-
 include/zynqpl.h                           |  59 +++++
 21 files changed, 848 insertions(+), 353 deletions(-)
 create mode 100644 drivers/fpga/zynqpl.c
 create mode 100644 include/zynqpl.h

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130503/cb986704/attachment.pgp>

#1 lore raw

PATCH v3 1/9 fpga: Clean coding style

No functional changes.

---
Changes in v3: None
Changes in v2:
- Fix compilation warnings

 drivers/fpga/fpga.c | 216 ++++++++++++++++++++++++----------------------------
 1 file changed, 98 insertions(+), 118 deletions(-)
drivers/fpga/fpga.c +98 -118
index 26d2443..ddebd49 100644
@@ -22,122 +22,99 @@
  *
  */
 
-/*
- *  Generic FPGA support
- */
+/* Generic FPGA support */
 #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 */
-#endif
-
 /* Local definitions */
 #ifndef CONFIG_MAX_FPGA_DEVICES
 #define CONFIG_MAX_FPGA_DEVICES		5
 #endif
 
-/* Enable/Disable debug console messages */
-#ifdef FPGA_DEBUG
-#define	PRINTF(fmt,args...)	printf (fmt ,##args)
-#else
-#define	PRINTF(fmt,args...)
-#endif
-
 /* Local static data */
 static int next_desc = FPGA_INVALID_DEVICE;
 static fpga_desc desc_table[CONFIG_MAX_FPGA_DEVICES];
 
-/* Local static functions */
-static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_get_desc( int devnum );
-static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_validate(int devnum, const void *buf,
-					 size_t bsize, char *fn );
-static int fpga_dev_info( int devnum );
-
-
-/* ------------------------------------------------------------------------- */
-
-/* fpga_no_sup
+/*
+ * fpga_no_sup
  * 'no support' message function
  */
-static void fpga_no_sup( char *fn, char *msg )
+static void fpga_no_sup(char *fn, char *msg)
 {
-	if ( fn && msg ) {
-		printf( "%s: No support for %s.\n", fn, msg);
-	} else if ( msg ) {
-		printf( "No support for %s.\n", msg);
-	} else {
-		printf( "No FPGA suport!\n");
-	}
+	if (fn && msg)
+		printf("%s: No support for %s.\n", fn, msg);
+	else if (msg)
+		printf("No support for %s.\n", msg);
+	else
+		printf("No FPGA suport!\n");
 }
 
 
 /* fpga_get_desc
  *	map a device number to a descriptor
  */
-static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_get_desc( int devnum )
+static const fpga_desc *const fpga_get_desc(int devnum)
 {
-	fpga_desc *desc = (fpga_desc * )NULL;
+	fpga_desc *desc = (fpga_desc *)NULL;
 
-	if (( devnum >= 0 ) && (devnum < next_desc )) {
+	if ((devnum >= 0) && (devnum < next_desc)) {
 		desc = &desc_table[devnum];
-		PRINTF( "%s: found fpga descriptor #%d @ 0x%p\n",
-				__FUNCTION__, devnum, desc );
+		debug("%s: found fpga descriptor #%d @ 0x%p\n",
+		      __func__, devnum, desc);
 	}
 
 	return desc;
 }
 
-
-/* fpga_validate
+/*
+ * fpga_validate
  *	generic parameter checking code
  */
-static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_validate(int devnum, const void *buf,
-					 size_t bsize, char *fn )
+static const fpga_desc *const fpga_validate(int devnum, const void *buf,
+					 size_t bsize, char *fn)
 {
-	fpga_desc * desc = fpga_get_desc( devnum );
+	const fpga_desc *desc = fpga_get_desc(devnum);
 
-	if ( !desc ) {
-		printf( "%s: Invalid device number %d\n", fn, devnum );
-	}
+	if (!desc)
+		printf("%s: Invalid device number %d\n", fn, devnum);
 
-	if ( !buf ) {
-		printf( "%s: Null buffer.\n", fn );
+	if (!buf) {
+		printf("%s: Null buffer.\n", fn);
 		return (fpga_desc * const)NULL;
 	}
 	return desc;
 }
 
-
-/* fpga_dev_info
+/*
+ * fpga_dev_info
  *	generic multiplexing code
  */
-static int fpga_dev_info( int devnum )
+static int fpga_dev_info(int devnum)
 {
-	int ret_val = FPGA_FAIL;           /* assume failure */
-	const fpga_desc * const desc = fpga_get_desc( devnum );
+	int ret_val = FPGA_FAIL; /* assume failure */
+	const fpga_desc * const desc = fpga_get_desc(devnum);
 
-	if ( desc ) {
-		PRINTF( "%s: Device Descriptor @ 0x%p\n",
-				__FUNCTION__, desc->devdesc );
+	if (desc) {
+		debug("%s: Device Descriptor @ 0x%p\n",
+		      __func__, desc->devdesc);
 
-		switch ( desc->devtype ) {
+		switch (desc->devtype) {
 		case fpga_xilinx:
 #if defined(CONFIG_FPGA_XILINX)
-			printf( "Xilinx Device\nDescriptor @ 0x%p\n", desc );
-			ret_val = xilinx_info( desc->devdesc );
+			printf("Xilinx Device\nDescriptor @ 0x%p\n", desc);
+			ret_val = xilinx_info(desc->devdesc);
 #else
-			fpga_no_sup( (char *)__FUNCTION__, "Xilinx devices" );
+			fpga_no_sup((char *)__func__, "Xilinx devices");
 #endif
 			break;
 		case fpga_altera:
 #if defined(CONFIG_FPGA_ALTERA)
-			printf( "Altera Device\nDescriptor @ 0x%p\n", desc );
-			ret_val = altera_info( desc->devdesc );
+			printf("Altera Device\nDescriptor @ 0x%p\n", desc);
+			ret_val = altera_info(desc->devdesc);
 #else
-			fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
+			fpga_no_sup((char *)__func__, "Altera devices");
 #endif
 			break;
 		case fpga_lattice:
@@ -145,171 +122,174 @@ static int fpga_dev_info( int devnum )
 			printf("Lattice Device\nDescriptor @ 0x%p\n", desc);
 			ret_val = lattice_info(desc->devdesc);
 #else
-			fpga_no_sup( (char *)__FUNCTION__, "Lattice devices" );
+			fpga_no_sup((char *)__func__, "Lattice devices");
 #endif
 			break;
 		default:
-			printf( "%s: Invalid or unsupported device type %d\n",
-					__FUNCTION__, desc->devtype );
+			printf("%s: Invalid or unsupported device type %d\n",
+			       __func__, desc->devtype);
 		}
 	} else {
-		printf( "%s: Invalid device number %d\n",
-			__FUNCTION__, devnum );
+		printf("%s: Invalid device number %d\n", __func__, devnum);
 	}
 
 	return ret_val;
 }
 
-
-/* ------------------------------------------------------------------------- */
-/* fgpa_init is usually called from misc_init_r() and MUST be called
+/*
+ * fgpa_init is usually called from misc_init_r() and MUST be called
  * before any of the other fpga functions are used.
  */
 void fpga_init(void)
 {
 	next_desc = 0;
-	memset( desc_table, 0, sizeof(desc_table));
+	memset(desc_table, 0, sizeof(desc_table));
 
-	PRINTF( "%s: CONFIG_FPGA = 0x%x\n", __FUNCTION__, CONFIG_FPGA );
+	debug("%s: CONFIG_FPGA = 0x%x\n", __func__, CONFIG_FPGA);
 }
 
-/* fpga_count
+/*
+ * fpga_count
  * Basic interface function to get the current number of devices available.
  */
-int fpga_count( void )
+int fpga_count(void)
 {
 	return next_desc;
 }
 
-/* fpga_add
+/*
+ * fpga_add
  *	Add the device descriptor to the device table.
  */
-int fpga_add( fpga_type devtype, void *desc )
+int fpga_add(fpga_type devtype, void *desc)
 {
 	int devnum = FPGA_INVALID_DEVICE;
 
-	if ( next_desc  < 0 ) {
-		printf( "%s: FPGA support not initialized!\n", __FUNCTION__ );
-	} else if (( devtype > fpga_min_type ) && ( devtype < fpga_undefined )) {
-		if ( desc ) {
-			if ( next_desc < CONFIG_MAX_FPGA_DEVICES ) {
+	if (next_desc < 0) {
+		printf("%s: FPGA support not initialized!\n", __func__);
+	} else if ((devtype > fpga_min_type) && (devtype < fpga_undefined)) {
+		if (desc) {
+			if (next_desc < CONFIG_MAX_FPGA_DEVICES) {
 				devnum = next_desc;
 				desc_table[next_desc].devtype = devtype;
 				desc_table[next_desc++].devdesc = desc;
 			} else {
-				printf( "%s: Exceeded Max FPGA device count\n", __FUNCTION__ );
+				printf("%s: Exceeded Max FPGA device count\n",
+				       __func__);
 			}
 		} else {
-			printf( "%s: NULL device descriptor\n", __FUNCTION__ );
+			printf("%s: NULL device descriptor\n", __func__);
 		}
 	} else {
-		printf( "%s: Unsupported FPGA type %d\n", __FUNCTION__, devtype );
+		printf("%s: Unsupported FPGA type %d\n", __func__, devtype);
 	}
 
 	return devnum;
 }
 
 /*
- *	Generic multiplexing code
+ * Generic multiplexing code
  */
 int fpga_load(int devnum, const void *buf, size_t bsize)
 {
 	int ret_val = FPGA_FAIL;           /* assume failure */
-	fpga_desc * desc = fpga_validate( devnum, buf, bsize, (char *)__FUNCTION__ );
+	const fpga_desc *desc = fpga_validate(devnum, buf, bsize,
+					      (char *)__func__);
 
-	if ( desc ) {
-		switch ( desc->devtype ) {
+	if (desc) {
+		switch (desc->devtype) {
 		case fpga_xilinx:
 #if defined(CONFIG_FPGA_XILINX)
-			ret_val = xilinx_load( desc->devdesc, buf, bsize );
+			ret_val = xilinx_load(desc->devdesc, buf, bsize);
 #else
-			fpga_no_sup( (char *)__FUNCTION__, "Xilinx devices" );
+			fpga_no_sup((char *)__func__, "Xilinx devices");
 #endif
 			break;
 		case fpga_altera:
 #if defined(CONFIG_FPGA_ALTERA)
-			ret_val = altera_load( desc->devdesc, buf, bsize );
+			ret_val = altera_load(desc->devdesc, buf, bsize);
 #else
-			fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
+			fpga_no_sup((char *)__func__, "Altera devices");
 #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" );
+			fpga_no_sup((char *)__func__, "Lattice devices");
 #endif
 			break;
 		default:
-			printf( "%s: Invalid or unsupported device type %d\n",
-				__FUNCTION__, desc->devtype );
+			printf("%s: Invalid or unsupported device type %d\n",
+			       __func__, desc->devtype);
 		}
 	}
 
 	return ret_val;
 }
 
-/* fpga_dump
+/*
+ * fpga_dump
  *	generic multiplexing code
  */
 int fpga_dump(int devnum, const void *buf, size_t bsize)
 {
 	int ret_val = FPGA_FAIL;           /* assume failure */
-	fpga_desc * desc = fpga_validate( devnum, buf, bsize, (char *)__FUNCTION__ );
+	const fpga_desc *desc = fpga_validate(devnum, buf, bsize,
+					      (char *)__func__);
 
-	if ( desc ) {
-		switch ( desc->devtype ) {
+	if (desc) {
+		switch (desc->devtype) {
 		case fpga_xilinx:
 #if defined(CONFIG_FPGA_XILINX)
-			ret_val = xilinx_dump( desc->devdesc, buf, bsize );
+			ret_val = xilinx_dump(desc->devdesc, buf, bsize);
 #else
-			fpga_no_sup( (char *)__FUNCTION__, "Xilinx devices" );
+			fpga_no_sup((char *)__func__, "Xilinx devices");
 #endif
 			break;
 		case fpga_altera:
 #if defined(CONFIG_FPGA_ALTERA)
-			ret_val = altera_dump( desc->devdesc, buf, bsize );
+			ret_val = altera_dump(desc->devdesc, buf, bsize);
 #else
-			fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
+			fpga_no_sup((char *)__func__, "Altera devices");
 #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" );
+			fpga_no_sup((char *)__func__, "Lattice devices");
 #endif
 			break;
 		default:
-			printf( "%s: Invalid or unsupported device type %d\n",
-				__FUNCTION__, desc->devtype );
+			printf("%s: Invalid or unsupported device type %d\n",
+			       __func__, desc->devtype);
 		}
 	}
 
 	return ret_val;
 }
 
-
-/* fpga_info
+/*
+ * fpga_info
  *	front end to fpga_dev_info.  If devnum is invalid, report on all
  *	available devices.
  */
-int fpga_info( int devnum )
+int fpga_info(int devnum)
 {
-	if ( devnum == FPGA_INVALID_DEVICE ) {
-		if ( next_desc > 0 ) {
+	if (devnum == FPGA_INVALID_DEVICE) {
+		if (next_desc > 0) {
 			int dev;
 
-			for ( dev = 0; dev < next_desc; dev++ ) {
-				fpga_dev_info( dev );
-			}
+			for (dev = 0; dev < next_desc; dev++)
+				fpga_dev_info(dev);
+
 			return FPGA_SUCCESS;
 		} else {
-			printf( "%s: No FPGA devices available.\n", __FUNCTION__ );
+			printf("%s: No FPGA devices available.\n", __func__);
 			return FPGA_FAIL;
 		}
 	}
-	else return fpga_dev_info( devnum );
-}
 
-/* ------------------------------------------------------------------------- */
+	return fpga_dev_info(devnum);
+}

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130503/68fe972f/attachment.pgp>

#2 lore raw

PATCH v3 2/9 fpga: Fix debug message compilation error

In reply to Michal Simek

CONFIG_FPGA in past was a bitfield where bits
were use for vendor identification.

This fix should be the part of this commit:
"Improve configuration of FPGA subsystem"
(sha1: 0133502e39ff89b67c26cb4015e0e7e8d9571184)

---
Changes in v3: None
Changes in v2:
- Fix grammer in the commit message

 drivers/fpga/fpga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/fpga.c +1 -1
index ddebd49..43bdf4f 100644
@@ -145,7 +145,7 @@ void fpga_init(void)
 	next_desc = 0;
 	memset(desc_table, 0, sizeof(desc_table));
 
-	debug("%s: CONFIG_FPGA = 0x%x\n", __func__, CONFIG_FPGA);
+	debug("%s\n", __func__);
 }
 
 /*

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130503/32b8ac9a/attachment.pgp>

#3 lore raw

PATCH v3 3/9 cmd: fpga: Clean coding style

In reply to Michal Simek

No functional changes.

---
Changes in v3: None
Changes in v2: None

I had to shorten some debug messages and divide them to two parts to pass checkpatch.

---
 common/cmd_fpga.c | 213 +++++++++++++++++++++++++++---------------------------
 1 file changed, 107 insertions(+), 106 deletions(-)
common/cmd_fpga.c +107 -106
index 1834246..f3579bb 100644
@@ -34,7 +34,7 @@
 #include <malloc.h>
 
 /* Local functions */
-static int fpga_get_op (char *opstr);
+static int fpga_get_op(char *opstr);
 
 /* Local defines */
 #define FPGA_NONE   -1
@@ -45,7 +45,7 @@ static int fpga_get_op (char *opstr);
 #define FPGA_LOADMK 4
 
 /* Convert bitstream data and load into the fpga */
-int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
+int fpga_loadbitstream(unsigned long dev, char *fpgadata, size_t size)
 {
 #if defined(CONFIG_FPGA_XILINX)
 	unsigned int length;
@@ -58,38 +58,36 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
 	dataptr = (unsigned char *)fpgadata;
 
 	/* skip the first bytes of the bitsteam, their meaning is unknown */
-	length = (*dataptr << 8) + *(dataptr+1);
-	dataptr+=2;
-	dataptr+=length;
+	length = (*dataptr << 8) + *(dataptr + 1);
+	dataptr += 2;
+	dataptr += length;
 
 	/* get design name (identifier, length, string) */
-	length = (*dataptr << 8) + *(dataptr+1);
-	dataptr+=2;
+	length = (*dataptr << 8) + *(dataptr + 1);
+	dataptr += 2;
 	if (*dataptr++ != 0x61) {
-		debug("%s: Design name identifier not recognized "
-			"in bitstream\n",
-			__func__);
+		debug("%s: Design name id not recognized in bitstream\n",
+		      __func__);
 		return FPGA_FAIL;
 	}
 
-	length = (*dataptr << 8) + *(dataptr+1);
-	dataptr+=2;
-	for(i=0;i<length;i++)
+	length = (*dataptr << 8) + *(dataptr + 1);
+	dataptr += 2;
+	for (i = 0; i < length; i++)
 		buffer[i] = *dataptr++;
 
 	printf("  design filename = \"%s\"\n", buffer);
 
 	/* get part number (identifier, length, string) */
 	if (*dataptr++ != 0x62) {
-		printf("%s: Part number identifier not recognized "
-			"in bitstream\n",
-			__func__);
+		printf("%s: Part number id not recognized in bitstream\n",
+		       __func__);
 		return FPGA_FAIL;
 	}
 
-	length = (*dataptr << 8) + *(dataptr+1);
-	dataptr+=2;
-	for(i=0;i<length;i++)
+	length = (*dataptr << 8) + *(dataptr + 1);
+	dataptr += 2;
+	for (i = 0; i < length; i++)
 		buffer[i] = *dataptr++;
 	printf("  part number = \"%s\"\n", buffer);
 
@@ -101,35 +99,35 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
 	}
 
 	length = (*dataptr << 8) + *(dataptr+1);
-	dataptr+=2;
-	for(i=0;i<length;i++)
+	dataptr += 2;
+	for (i = 0; i < length; i++)
 		buffer[i] = *dataptr++;
 	printf("  date = \"%s\"\n", buffer);
 
 	/* get time (identifier, length, string) */
 	if (*dataptr++ != 0x64) {
 		printf("%s: Time identifier not recognized in bitstream\n",
-			__func__);
+		       __func__);
 		return FPGA_FAIL;
 	}
 
 	length = (*dataptr << 8) + *(dataptr+1);
-	dataptr+=2;
-	for(i=0;i<length;i++)
+	dataptr += 2;
+	for (i = 0; i < length; i++)
 		buffer[i] = *dataptr++;
 	printf("  time = \"%s\"\n", buffer);
 
 	/* get fpga data length (identifier, length) */
 	if (*dataptr++ != 0x65) {
-		printf("%s: Data length identifier not recognized in bitstream\n",
-			__func__);
+		printf("%s: Data length id not recognized in bitstream\n",
+		       __func__);
 		return FPGA_FAIL;
 	}
-	swapsize = ((unsigned int) *dataptr     <<24) +
-	           ((unsigned int) *(dataptr+1) <<16) +
-	           ((unsigned int) *(dataptr+2) <<8 ) +
-	           ((unsigned int) *(dataptr+3)     ) ;
-	dataptr+=4;
+	swapsize = ((unsigned int) *dataptr << 24) +
+		   ((unsigned int) *(dataptr + 1) << 16) +
+		   ((unsigned int) *(dataptr + 2) << 8) +
+		   ((unsigned int) *(dataptr + 3));
+	dataptr += 4;
 	printf("  bytes in bitstream = %d\n", swapsize);
 
 	rc = fpga_load(dev, dataptr, swapsize);
@@ -148,81 +146,81 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
  * If there is no data addr field, the fpgadata environment variable is used.
  * The info command requires no data address field.
  */
-int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
 	int op, dev = FPGA_INVALID_DEVICE;
 	size_t data_size = 0;
 	void *fpga_data = NULL;
-	char *devstr = getenv ("fpga");
-	char *datastr = getenv ("fpgadata");
+	char *devstr = getenv("fpga");
+	char *datastr = getenv("fpgadata");
 	int rc = FPGA_FAIL;
 	int wrong_parms = 0;
-#if defined (CONFIG_FIT)
+#if defined(CONFIG_FIT)
 	const char *fit_uname = NULL;
 	ulong fit_addr;
 #endif
 
 	if (devstr)
-		dev = (int) simple_strtoul (devstr, NULL, 16);
+		dev = (int) simple_strtoul(devstr, NULL, 16);
 	if (datastr)
-		fpga_data = (void *) simple_strtoul (datastr, NULL, 16);
+		fpga_data = (void *)simple_strtoul(datastr, NULL, 16);
 
 	switch (argc) {
 	case 5:		/* fpga <op> <dev> <data> <datasize> */
-		data_size = simple_strtoul (argv[4], NULL, 16);
+		data_size = simple_strtoul(argv[4], NULL, 16);
 
 	case 4:		/* fpga <op> <dev> <data> */
 #if defined(CONFIG_FIT)
-		if (fit_parse_subimage (argv[3], (ulong)fpga_data,
-					&fit_addr, &fit_uname)) {
+		if (fit_parse_subimage(argv[3], (ulong)fpga_data,
+				       &fit_addr, &fit_uname)) {
 			fpga_data = (void *)fit_addr;
-			debug("*  fpga: subimage '%s' from FIT image "
-				"at 0x%08lx\n",
-				fit_uname, fit_addr);
+			debug("*  fpga: subimage '%s' from FIT image ",
+			      fit_uname);
+			debug("at 0x%08lx\n", fit_addr);
 		} else
 #endif
 		{
-			fpga_data = (void *) simple_strtoul (argv[3], NULL, 16);
+			fpga_data = (void *)simple_strtoul(argv[3], NULL, 16);
 			debug("*  fpga: cmdline image address = 0x%08lx\n",
-				(ulong)fpga_data);
+			      (ulong)fpga_data);
 		}
-		debug("%s: fpga_data = 0x%x\n", __func__, (uint) fpga_data);
+		debug("%s: fpga_data = 0x%x\n", __func__, (uint)fpga_data);
 
 	case 3:		/* fpga <op> <dev | data addr> */
-		dev = (int) simple_strtoul (argv[2], NULL, 16);
+		dev = (int)simple_strtoul(argv[2], NULL, 16);
 		debug("%s: device = %d\n", __func__, dev);
 		/* FIXME - this is a really weak test */
-		if ((argc == 3) && (dev > fpga_count ())) {	/* must be buffer ptr */
+		if ((argc == 3) && (dev > fpga_count())) {
+			/* must be buffer ptr */
 			debug("%s: Assuming buffer pointer in arg 3\n",
-				__func__);
+			      __func__);
 
 #if defined(CONFIG_FIT)
-			if (fit_parse_subimage (argv[2], (ulong)fpga_data,
-						&fit_addr, &fit_uname)) {
+			if (fit_parse_subimage(argv[2], (ulong)fpga_data,
+					       &fit_addr, &fit_uname)) {
 				fpga_data = (void *)fit_addr;
-				debug("*  fpga: subimage '%s' from FIT image "
-					"at 0x%08lx\n",
-					fit_uname, fit_addr);
+				debug("*  fpga: subimage '%s' from FIT image ",
+				      fit_uname);
+				debug("at 0x%08lx\n", fit_addr);
 			} else
 #endif
 			{
-				fpga_data = (void *) dev;
-				debug("*  fpga: cmdline image address = "
-					"0x%08lx\n", (ulong)fpga_data);
+				fpga_data = (void *)dev;
+				debug("*  fpga: cmdline image addr = 0x%08lx\n",
+				      (ulong)fpga_data);
 			}
 
 			debug("%s: fpga_data = 0x%x\n",
-				__func__, (uint) fpga_data);
+			      __func__, (uint)fpga_data);
 			dev = FPGA_INVALID_DEVICE;	/* reset device num */
 		}
 
 	case 2:		/* fpga <op> */
-		op = (int) fpga_get_op (argv[1]);
+		op = (int)fpga_get_op(argv[1]);
 		break;
 
 	default:
-		debug("%s: Too many or too few args (%d)\n",
-			__func__, argc);
+		debug("%s: Too many or too few args (%d)\n", __func__, argc);
 		op = FPGA_NONE;	/* force usage display */
 		break;
 	}
@@ -258,11 +256,11 @@ int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 		return CMD_RET_USAGE;
 
 	case FPGA_INFO:
-		rc = fpga_info (dev);
+		rc = fpga_info(dev);
 		break;
 
 	case FPGA_LOAD:
-		rc = fpga_load (dev, fpga_data, data_size);
+		rc = fpga_load(dev, fpga_data, data_size);
 		break;
 
 	case FPGA_LOADB:
@@ -270,15 +268,16 @@ int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 		break;
 
 	case FPGA_LOADMK:
-		switch (genimg_get_format (fpga_data)) {
+		switch (genimg_get_format(fpga_data)) {
 		case IMAGE_FORMAT_LEGACY:
 			{
-				image_header_t *hdr = (image_header_t *)fpga_data;
-				ulong	data;
+				image_header_t *hdr =
+						(image_header_t *)fpga_data;
+				ulong data;
 
-				data = (ulong)image_get_data (hdr);
-				data_size = image_get_data_size (hdr);
-				rc = fpga_load (dev, (void *)data, data_size);
+				data = (ulong)image_get_data(hdr);
+				data_size = image_get_data_size(hdr);
+				rc = fpga_load(dev, (void *)data, data_size);
 			}
 			break;
 #if defined(CONFIG_FIT)
@@ -289,95 +288,97 @@ int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 				const void *fit_data;
 
 				if (fit_uname == NULL) {
-					puts ("No FIT subimage unit name\n");
+					puts("No FIT subimage unit name\n");
 					return 1;
 				}
 
-				if (!fit_check_format (fit_hdr)) {
-					puts ("Bad FIT image format\n");
+				if (!fit_check_format(fit_hdr)) {
+					puts("Bad FIT image format\n");
 					return 1;
 				}
 
 				/* get fpga component image node offset */
-				noffset = fit_image_get_node (fit_hdr, fit_uname);
+				noffset = fit_image_get_node(fit_hdr,
+							     fit_uname);
 				if (noffset < 0) {
-					printf ("Can't find '%s' FIT subimage\n", fit_uname);
+					printf("Can't find '%s' FIT subimage\n",
+					       fit_uname);
 					return 1;
 				}
 
 				/* verify integrity */
-				if (!fit_image_check_hashes (fit_hdr, noffset)) {
-					puts ("Bad Data Hash\n");
+				if (!fit_image_check_hashes(fit_hdr, noffset)) {
+					puts("Bad Data Hash\n");
 					return 1;
 				}
 
 				/* get fpga subimage data address and length */
-				if (fit_image_get_data (fit_hdr, noffset, &fit_data, &data_size)) {
-					puts ("Could not find fpga subimage data\n");
+				if (fit_image_get_data(fit_hdr, noffset,
+						       &fit_data, &data_size)) {
+					puts("Fpga subimage data not found\n");
 					return 1;
 				}
 
-				rc = fpga_load (dev, fit_data, data_size);
+				rc = fpga_load(dev, fit_data, data_size);
 			}
 			break;
 #endif
 		default:
-			puts ("** Unknown image type\n");
+			puts("** Unknown image type\n");
 			rc = FPGA_FAIL;
 			break;
 		}
 		break;
 
 	case FPGA_DUMP:
-		rc = fpga_dump (dev, fpga_data, data_size);
+		rc = fpga_dump(dev, fpga_data, data_size);
 		break;
 
 	default:
-		printf ("Unknown operation\n");
+		printf("Unknown operation\n");
 		return CMD_RET_USAGE;
 	}
-	return (rc);
+	return rc;
 }
 
 /*
  * Map op to supported operations.  We don't use a table since we
  * would just have to relocate it from flash anyway.
  */
-static int fpga_get_op (char *opstr)
+static int fpga_get_op(char *opstr)
 {
 	int op = FPGA_NONE;
 
-	if (!strcmp ("info", opstr)) {
+	if (!strcmp("info", opstr))
 		op = FPGA_INFO;
-	} else if (!strcmp ("loadb", opstr)) {
+	else if (!strcmp("loadb", opstr))
 		op = FPGA_LOADB;
-	} else if (!strcmp ("load", opstr)) {
+	else if (!strcmp("load", opstr))
 		op = FPGA_LOAD;
-	} else if (!strcmp ("loadmk", opstr)) {
+	else if (!strcmp("loadmk", opstr))
 		op = FPGA_LOADMK;
-	} else if (!strcmp ("dump", opstr)) {
+	else if (!strcmp("dump", opstr))
 		op = FPGA_DUMP;
-	}
 
-	if (op == FPGA_NONE) {
-		printf ("Unknown fpga operation \"%s\"\n", opstr);
-	}
+	if (op == FPGA_NONE)
+		printf("Unknown fpga operation \"%s\"\n", opstr);
+
 	return op;
 }
 
-U_BOOT_CMD (fpga, 6, 1, do_fpga,
-	"loadable FPGA image support",
-	"[operation type] [device number] [image address] [image size]\n"
-	"fpga operations:\n"
-	"  dump\t[dev]\t\t\tLoad device to memory buffer\n"
-	"  info\t[dev]\t\t\tlist known device information\n"
-	"  load\t[dev] [address] [size]\tLoad device from memory buffer\n"
-	"  loadb\t[dev] [address] [size]\t"
-	"Load device from bitstream buffer (Xilinx only)\n"
-	"  loadmk [dev] [address]\tLoad device generated with mkimage"
+U_BOOT_CMD(fpga, 6, 1, do_fpga,
+	   "loadable FPGA image support",
+	   "[operation type] [device number] [image address] [image size]\n"
+	   "fpga operations:\n"
+	   "  dump\t[dev]\t\t\tLoad device to memory buffer\n"
+	   "  info\t[dev]\t\t\tlist known device information\n"
+	   "  load\t[dev] [address] [size]\tLoad device from memory buffer\n"
+	   "  loadb\t[dev] [address] [size]\t"
+	   "Load device from bitstream buffer (Xilinx only)\n"
+	   "  loadmk [dev] [address]\tLoad device generated with mkimage"
 #if defined(CONFIG_FIT)
-	"\n"
-	"\tFor loadmk operating on FIT format uImage address must include\n"
-	"\tsubimage unit name in the form of addr:<subimg_uname>"
+	   "\n"
+	   "\tFor loadmk operating on FIT format uImage address must include\n"
+	   "\tsubimage unit name in the form of addr:<subimg_uname>"
 #endif
 );

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130503/9497cbaf/attachment.pgp>

#4 lore raw

PATCH v3 4/9 cmd: fpga: Move fpga_loadbitstream to fpga.c

In reply to Michal Simek

In bitstream decoding you can directly check device which you want to load and in fpga.c are fpga_validate and fpga_dev_info functions which should be used for it.

---
Changes in v3:
- Setup fpga_loadbitstream as weak function

Changes in v2: None

 common/cmd_fpga.c     | 94 ---------------------------------------------------
 drivers/fpga/fpga.c   |  9 +++++
 drivers/fpga/xilinx.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++
 include/fpga.h        |  1 +
 4 files changed, 96 insertions(+), 94 deletions(-)
common/cmd_fpga.c +0 -94
index f3579bb..aa14ceb 100644
@@ -44,100 +44,6 @@ static int fpga_get_op(char *opstr);
 #define FPGA_DUMP   3
 #define FPGA_LOADMK 4
 
-/* Convert bitstream data and load into the fpga */
-int fpga_loadbitstream(unsigned long dev, char *fpgadata, size_t size)
-{
-#if defined(CONFIG_FPGA_XILINX)
-	unsigned int length;
-	unsigned int swapsize;
-	char buffer[80];
-	unsigned char *dataptr;
-	unsigned int i;
-	int rc;
-
-	dataptr = (unsigned char *)fpgadata;
-
-	/* skip the first bytes of the bitsteam, their meaning is unknown */
-	length = (*dataptr << 8) + *(dataptr + 1);
-	dataptr += 2;
-	dataptr += length;
-
-	/* get design name (identifier, length, string) */
-	length = (*dataptr << 8) + *(dataptr + 1);
-	dataptr += 2;
-	if (*dataptr++ != 0x61) {
-		debug("%s: Design name id not recognized in bitstream\n",
-		      __func__);
-		return FPGA_FAIL;
-	}
-
-	length = (*dataptr << 8) + *(dataptr + 1);
-	dataptr += 2;
-	for (i = 0; i < length; i++)
-		buffer[i] = *dataptr++;
-
-	printf("  design filename = \"%s\"\n", buffer);
-
-	/* get part number (identifier, length, string) */
-	if (*dataptr++ != 0x62) {
-		printf("%s: Part number id not recognized in bitstream\n",
-		       __func__);
-		return FPGA_FAIL;
-	}
-
-	length = (*dataptr << 8) + *(dataptr + 1);
-	dataptr += 2;
-	for (i = 0; i < length; i++)
-		buffer[i] = *dataptr++;
-	printf("  part number = \"%s\"\n", buffer);
-
-	/* get date (identifier, length, string) */
-	if (*dataptr++ != 0x63) {
-		printf("%s: Date identifier not recognized in bitstream\n",
-		       __func__);
-		return FPGA_FAIL;
-	}
-
-	length = (*dataptr << 8) + *(dataptr+1);
-	dataptr += 2;
-	for (i = 0; i < length; i++)
-		buffer[i] = *dataptr++;
-	printf("  date = \"%s\"\n", buffer);
-
-	/* get time (identifier, length, string) */
-	if (*dataptr++ != 0x64) {
-		printf("%s: Time identifier not recognized in bitstream\n",
-		       __func__);
-		return FPGA_FAIL;
-	}
-
-	length = (*dataptr << 8) + *(dataptr+1);
-	dataptr += 2;
-	for (i = 0; i < length; i++)
-		buffer[i] = *dataptr++;
-	printf("  time = \"%s\"\n", buffer);
-
-	/* get fpga data length (identifier, length) */
-	if (*dataptr++ != 0x65) {
-		printf("%s: Data length id not recognized in bitstream\n",
-		       __func__);
-		return FPGA_FAIL;
-	}
-	swapsize = ((unsigned int) *dataptr << 24) +
-		   ((unsigned int) *(dataptr + 1) << 16) +
-		   ((unsigned int) *(dataptr + 2) << 8) +
-		   ((unsigned int) *(dataptr + 3));
-	dataptr += 4;
-	printf("  bytes in bitstream = %d\n", swapsize);
-
-	rc = fpga_load(dev, dataptr, swapsize);
-	return rc;
-#else
-	printf("Bitstream support only for Xilinx devices\n");
-	return FPGA_FAIL;
-#endif
-}
-
 /* ------------------------------------------------------------------------- */
 /* command form:
  *   fpga <op> <device number> <data addr> <datasize>
drivers/fpga/fpga.c +9 -0
index 43bdf4f..f0253bf 100644
@@ -188,6 +188,15 @@ int fpga_add(fpga_type devtype, void *desc)
 }
 
 /*
+ * Convert bitstream data and load into the fpga
+ */
+int __weak fpga_loadbitstream(unsigned long dev, char *fpgadata, size_t size)
+{
+	printf("Bitstream support not implemented for this FPGA device\n");
+	return FPGA_FAIL;
+}
+
+/*
  * Generic multiplexing code
  */
 int fpga_load(int devnum, const void *buf, size_t bsize)
drivers/fpga/xilinx.c +86 -0

92 lines not on this page · raw message

include/fpga.h +1 -0
index 30a4e6a..0d01e04 100644
@@ -68,6 +68,7 @@ extern void fpga_init(void);
 extern int fpga_add(fpga_type devtype, void *desc);
 extern int fpga_count(void);
 extern int fpga_load(int devnum, const void *buf, size_t bsize);
+extern int fpga_loadbitstream(unsigned long dev, char *fpgadata, size_t size);
 extern int fpga_dump(int devnum, const void *buf, size_t bsize);
 extern int fpga_info(int devnum);
 

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130503/b704807f/attachment.pgp>

#5 lore raw

PATCH v3 5/9 fpga: Change the first parameter in fpga_loadbitstream

In reply to Michal Simek

All fpga functions use devnum as int. Only fpga_loadbitstream is using it as unsinged long dev.
This patch synchronize it.

---
Changes in v3:
- New patch in this series

Changes in v2: None

 drivers/fpga/fpga.c   | 2 +-
 drivers/fpga/xilinx.c | 4 ++--
 include/fpga.h        | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/fpga/fpga.c +1 -1
index f0253bf..244f503 100644
@@ -190,7 +190,7 @@ int fpga_add(fpga_type devtype, void *desc)
 /*
  * Convert bitstream data and load into the fpga
  */
-int __weak fpga_loadbitstream(unsigned long dev, char *fpgadata, size_t size)
+int __weak fpga_loadbitstream(int devnum, char *fpgadata, size_t size)
 {
 	printf("Bitstream support not implemented for this FPGA device\n");
 	return FPGA_FAIL;
drivers/fpga/xilinx.c +2 -2
index 7d0342a..df5f9bf 100644
@@ -48,7 +48,7 @@ static int xilinx_validate (Xilinx_desc * desc, char *fn);
 
 /* ------------------------------------------------------------------------- */
 
-int fpga_loadbitstream(unsigned long dev, char *fpgadata, size_t size)
+int fpga_loadbitstream(int devnum, char *fpgadata, size_t size)
 {
 	unsigned int length;
 	unsigned int swapsize;
@@ -131,7 +131,7 @@ int fpga_loadbitstream(unsigned long dev, char *fpgadata, size_t size)
 	dataptr += 4;
 	printf("  bytes in bitstream = %d\n", swapsize);
 
-	return fpga_load(dev, dataptr, swapsize);
+	return fpga_load(devnum, dataptr, swapsize);
 }
 
 int xilinx_load(Xilinx_desc *desc, const void *buf, size_t bsize)
include/fpga.h +1 -1
index 0d01e04..38f62c0 100644
@@ -68,7 +68,7 @@ extern void fpga_init(void);
 extern int fpga_add(fpga_type devtype, void *desc);
 extern int fpga_count(void);
 extern int fpga_load(int devnum, const void *buf, size_t bsize);
-extern int fpga_loadbitstream(unsigned long dev, char *fpgadata, size_t size);
+extern int fpga_loadbitstream(int devnum, char *fpgadata, size_t size);
 extern int fpga_dump(int devnum, const void *buf, size_t bsize);
 extern int fpga_info(int devnum);
 

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130503/93b2fa48/attachment.pgp>

#6 lore raw

PATCH v3 6/9 cmd: fpga: Do not include net.h

In reply to Michal Simek

There is no reason to include net.h header in fpga code.

---
Changes in v3: None
Changes in v2: None

 common/cmd_fpga.c | 3 ---
 1 file changed, 3 deletions(-)
common/cmd_fpga.c +0 -3
index aa14ceb..5e1d037 100644
@@ -27,9 +27,6 @@
  */
 #include <common.h>
 #include <command.h>
-#if defined(CONFIG_CMD_NET)
-#include <net.h>
-#endif
 #include <fpga.h>
 #include <malloc.h>
 

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130503/8ddbc21c/attachment.pgp>

#7 lore raw

PATCH v3 7/9 fpga: zynq: Add support for loading bitstream

In reply to Michal Simek

Devcfg device requires to load bitstream in binary format. But u-boot also has an option for loading bitstream in bit format. Let's handle both cases by zynqpl driver. Also add suport for loading partial bitstreams.

The first driver version was done by:
Joe Hershberger <[email protected]>

---
Changes in v3: None
Changes in v2:
- Fix bugs reported by Tom Rini
- Fix checkpatch warnings (fpga)
- Fix comments (fpga)
- Do not use CamelCase for XilinxZynq (fpga)
- Move to fpga series and extend this driver

This patch was the part of zynq series but I have decided to extend it with partial bitstream support, loadb support and create separate patchset just for fpga patches. The origin patch was reviewed by Tom Rini.

---
 arch/arm/cpu/armv7/zynq/slcr.c             |  35 +++
 arch/arm/include/asm/arch-zynq/hardware.h  |  10 +-
 arch/arm/include/asm/arch-zynq/sys_proto.h |   3 +
 board/xilinx/zynq/board.c                  |  37 +++
 drivers/fpga/Makefile                      |   1 +
 drivers/fpga/xilinx.c                      |  37 +++
 drivers/fpga/zynqpl.c                      | 355 +++++++++++++++++++++++++++++
 include/configs/zynq.h                     |   6 +
 include/xilinx.h                           |   4 +
 include/zynqpl.h                           |  59 +++++
 10 files changed, 545 insertions(+), 2 deletions(-)
 create mode 100644 drivers/fpga/zynqpl.c
 create mode 100644 include/zynqpl.h
arch/arm/cpu/armv7/zynq/slcr.c +35 -0
index 5a8674a..52048c6 100644
@@ -28,6 +28,9 @@
 #define SLCR_LOCK_MAGIC		0x767B
 #define SLCR_UNLOCK_MAGIC	0xDF0D
 
+#define SLCR_IDCODE_MASK	0x1F000
+#define SLCR_IDCODE_SHIFT	12
+
 static int slcr_lock = 1; /* 1 means locked, 0 means unlocked */
 
 void zynq_slcr_lock(void)
@@ -87,3 +90,35 @@ void zynq_slcr_gem_clk_setup(u32 gem_id, u32 rclk, u32 clk)
 out:
 	zynq_slcr_lock();
 }
+
+void zynq_slcr_devcfg_disable(void)
+{
+	zynq_slcr_unlock();
+
+	/* Disable AXI interface */
+	writel(0xFFFFFFFF, &slcr_base->fpga_rst_ctrl);
+
+	/* Set Level Shifters DT618760 */
+	writel(0xA, &slcr_base->lvl_shftr_en);
+
+	zynq_slcr_lock();
+}
+
+void zynq_slcr_devcfg_enable(void)
+{
+	zynq_slcr_unlock();
+
+	/* Set Level Shifters DT618760 */
+	writel(0xF, &slcr_base->lvl_shftr_en);
+
+	/* Disable AXI interface */
+	writel(0x0, &slcr_base->fpga_rst_ctrl);
+
+	zynq_slcr_lock();
+}
+
+u32 zynq_slcr_get_idcode(void)
+{
+	return (readl(&slcr_base->pss_idcode) & SLCR_IDCODE_MASK) >>
+							SLCR_IDCODE_SHIFT;
+}
arch/arm/include/asm/arch-zynq/hardware.h +8 -2
index 6af892a..8b8a91a 100644
@@ -53,11 +53,17 @@ struct slcr_regs {
 	u32 boot_mode; /* 0x25c */
 	u32 reserved4[116];
 	u32 trust_zone; /* 0x430 */ /* FIXME */
-	u32 reserved5[115];
+	u32 reserved5_1[63];
+	u32 pss_idcode; /* 0x530 */
+	u32 reserved5_2[51];
 	u32 ddr_urgent; /* 0x600 */
 	u32 reserved6[6];
 	u32 ddr_urgent_sel; /* 0x61c */
-	u32 reserved7[188];
+	u32 reserved7[56];
+	u32 mio_pin[54]; /* 0x700 - 0x7D4 */
+	u32 reserved8[74];
+	u32 lvl_shftr_en; /* 0x900 */
+	u32 reserved9[3];
 	u32 ocm_cfg; /* 0x910 */
 };
 
arch/arm/include/asm/arch-zynq/sys_proto.h +3 -0
index af9e7f8..2317121 100644
@@ -27,6 +27,9 @@ extern void zynq_slcr_lock(void);
 extern void zynq_slcr_unlock(void);
 extern void zynq_slcr_cpu_reset(void);
 extern void zynq_slcr_gem_clk_setup(u32 gem_id, u32 rclk, u32 clk);
+extern void zynq_slcr_devcfg_disable(void);
+extern void zynq_slcr_devcfg_enable(void);
+extern u32 zynq_slcr_get_idcode(void);
 
 /* Driver extern functions */
 extern int zynq_sdhci_init(u32 regbase);
board/xilinx/zynq/board.c +37 -0
index 1589d21..b02c364 100644
@@ -22,15 +22,52 @@
 
 #include <common.h>
 #include <netdev.h>
+#include <zynqpl.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_FPGA
+Xilinx_desc fpga;
+
+/* It can be done differently */
+Xilinx_desc fpga010 = XILINX_XC7Z010_DESC(0x10);
+Xilinx_desc fpga020 = XILINX_XC7Z020_DESC(0x20);
+Xilinx_desc fpga030 = XILINX_XC7Z030_DESC(0x30);
+Xilinx_desc fpga045 = XILINX_XC7Z045_DESC(0x45);
+#endif
+
 int board_init(void)
 {
+#ifdef CONFIG_FPGA
+	u32 idcode;
+
+	idcode = zynq_slcr_get_idcode();
+
+	switch (idcode) {
+	case XILINX_ZYNQ_7010:
+		fpga = fpga010;
+		break;
+	case XILINX_ZYNQ_7020:
+		fpga = fpga020;
+		break;
+	case XILINX_ZYNQ_7030:
+		fpga = fpga030;
+		break;
+	case XILINX_ZYNQ_7045:
+		fpga = fpga045;
+		break;
+	}
+#endif
+
 	icache_enable();
 
+#ifdef CONFIG_FPGA
+	fpga_init();
+	fpga_add(fpga_xilinx, &fpga);
+#endif
+
 	return 0;
 }
 
drivers/fpga/Makefile +1 -0
index b48f623..0b51dcd 100644
@@ -30,6 +30,7 @@ COBJS-y += fpga.o
 COBJS-$(CONFIG_FPGA_SPARTAN2) += spartan2.o
 COBJS-$(CONFIG_FPGA_SPARTAN3) += spartan3.o
 COBJS-$(CONFIG_FPGA_VIRTEX2) += virtex2.o
+COBJS-$(CONFIG_FPGA_ZYNQPL) += zynqpl.o
 COBJS-$(CONFIG_FPGA_XILINX) += xilinx.o
 COBJS-$(CONFIG_FPGA_LATTICE) += ivm_core.o lattice.o
 ifdef CONFIG_FPGA_ALTERA
drivers/fpga/xilinx.c +37 -0
index df5f9bf..496aa2f 100644
@@ -1,4 +1,6 @@
 /*
+ * (C) Copyright 2012-2013, Xilinx, Michal Simek
+ *
  * (C) Copyright 2002
  * Rich Ireland, Enterasys Networks, rireland at enterasys.com.
  * Keith Outwater, keith_outwater at mvis.com
@@ -31,6 +33,7 @@
 #include <virtex2.h>
 #include <spartan2.h>
 #include <spartan3.h>
+#include <zynqpl.h>
 
 #if 0
 #define FPGA_DEBUG
@@ -172,6 +175,16 @@ int xilinx_load(Xilinx_desc *desc, const void *buf, size_t bsize)
 					__FUNCTION__);
 #endif
 			break;
+		case xilinx_zynq:
+#if defined(CONFIG_FPGA_ZYNQPL)
+			PRINTF("%s: Launching the Zynq PL Loader...\n",
+			       __func__);
+			ret_val = zynq_load(desc, buf, bsize);
+#else
+			printf("%s: No support for Zynq devices.\n",
+			       __func__);
+#endif
+			break;
 
 		default:
 			printf ("%s: Unsupported family type, %d\n",
@@ -219,6 +232,16 @@ int xilinx_dump(Xilinx_desc *desc, const void *buf, size_t bsize)
 					__FUNCTION__);
 #endif
 			break;
+		case xilinx_zynq:
+#if defined(CONFIG_FPGA_ZYNQPL)
+			PRINTF("%s: Launching the Zynq PL Reader...\n",
+			       __func__);
+			ret_val = zynq_dump(desc, buf, bsize);
+#else
+			printf("%s: No support for Zynq devices.\n",
+			       __func__);
+#endif
+			break;
 
 		default:
 			printf ("%s: Unsupported family type, %d\n",
@@ -244,6 +267,9 @@ int xilinx_info (Xilinx_desc * desc)
 		case Xilinx_Virtex2:
 			printf ("Virtex-II\n");
 			break;
+		case xilinx_zynq:
+			printf("Zynq PL\n");
+			break;
 			/* Add new family types here */
 		default:
 			printf ("Unknown family type, %d\n", desc->family);
@@ -269,6 +295,9 @@ int xilinx_info (Xilinx_desc * desc)
 		case master_selectmap:
 			printf ("Master SelectMap Mode\n");
 			break;
+		case devcfg:
+			printf("Device configuration interface (Zynq)\n");
+			break;
 			/* Add new interface types here */
 		default:
 			printf ("Unsupported interface type, %d\n", desc->iface);
@@ -308,6 +337,14 @@ int xilinx_info (Xilinx_desc * desc)
 						__FUNCTION__);
 #endif
 				break;
+			case xilinx_zynq:
+#if defined(CONFIG_FPGA_ZYNQPL)
+				zynq_info(desc);
+#else
+				/* just in case */
+				printf("%s: No support for Zynq devices.\n",
+				       __func__);
+#endif
 				/* Add new family types here */
 			default:
 				/* we don't need a message here - we give one up above */
drivers/fpga/zynqpl.c new file +355 -0

355 lines not on this page · raw message

include/configs/zynq.h +6 -0
index f1f182e..38f04f6 100644
@@ -88,6 +88,12 @@
 # define CONFIG_CPU_V6 /* Required by CONFIG_ARM_DCC */
 #endif
 
+/* Enable the PL to be downloaded */
+#define CONFIG_FPGA
+#define CONFIG_FPGA_XILINX
+#define CONFIG_FPGA_ZYNQPL
+#define CONFIG_CMD_FPGA
+
 #define CONFIG_BOOTP_SERVERIP
 #define CONFIG_BOOTP_BOOTPATH
 #define CONFIG_BOOTP_GATEWAY
include/xilinx.h +4 -0
index 5f25b7a..592cbea 100644
@@ -33,10 +33,12 @@
 #define CONFIG_SYS_VIRTEX_E			CONFIG_SYS_FPGA_DEV( 0x2 )
 #define CONFIG_SYS_VIRTEX2			CONFIG_SYS_FPGA_DEV( 0x4 )
 #define CONFIG_SYS_SPARTAN3			CONFIG_SYS_FPGA_DEV( 0x8 )
+#define CONFIG_SYS_ZYNQ				CONFIG_SYS_FPGA_DEV(0x10)
 #define CONFIG_SYS_XILINX_SPARTAN2	(CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_SPARTAN2)
 #define CONFIG_SYS_XILINX_VIRTEX_E	(CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_VIRTEX_E)
 #define CONFIG_SYS_XILINX_VIRTEX2	(CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_VIRTEX2)
 #define CONFIG_SYS_XILINX_SPARTAN3	(CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_SPARTAN3)
+#define CONFIG_SYS_XILINX_ZYNQ	(CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_ZYNQ)
 /* XXX - Add new models here */
 
 
@@ -59,6 +61,7 @@ typedef enum {			/* typedef Xilinx_iface */
 	jtag_mode,		/* jtag/tap serial (not used ) */
 	master_selectmap,	/* master SelectMap (virtex2)           */
 	slave_selectmap,	/* slave SelectMap (virtex2)            */
+	devcfg,			/* devcfg interface (zynq) */
 	max_xilinx_iface_type	/* insert all new types before this */
 } Xilinx_iface;			/* end, typedef Xilinx_iface */
 
@@ -68,6 +71,7 @@ typedef enum {			/* typedef Xilinx_Family */
 	Xilinx_VirtexE,		/* Virtex-E Family */
 	Xilinx_Virtex2,		/* Virtex2 Family */
 	Xilinx_Spartan3,	/* Spartan-III Family */
+	xilinx_zynq,		/* Zynq Family */
 	max_xilinx_type		/* insert all new types before this */
 } Xilinx_Family;		/* end, typedef Xilinx_Family */
 
include/zynqpl.h new file +59 -0

59 lines not on this page · raw message

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130503/5c0fd28b/attachment.pgp>

#8 lore raw

PATCH v3 8/9 fpga: Check device name against bitstream name

In reply to Michal Simek

Ensure that wrong bitstream won't be loaded
to current device.

---
Changes in v3:
- Rebase because of change in previous patch
- fpga_validate should be global function
- fix one printf function
- change parameter name according to previous patch dev->devnum

Changes in v2:
- New patch in this series

 drivers/fpga/fpga.c   |  4 ++--
 drivers/fpga/xilinx.c | 23 +++++++++++++++++++++++
 include/fpga.h        |  2 ++
 include/xilinx.h      |  1 +
 include/zynqpl.h      |  8 ++++----
 5 files changed, 32 insertions(+), 6 deletions(-)
drivers/fpga/fpga.c +2 -2
index 244f503..f70bff6 100644
@@ -72,8 +72,8 @@ static const fpga_desc *const fpga_get_desc(int devnum)
  * fpga_validate
  *	generic parameter checking code
  */
-static const fpga_desc *const fpga_validate(int devnum, const void *buf,
-					 size_t bsize, char *fn)
+const fpga_desc *const fpga_validate(int devnum, const void *buf,
+				     size_t bsize, char *fn)
 {
 	const fpga_desc *desc = fpga_get_desc(devnum);
 
drivers/fpga/xilinx.c +23 -0
index 496aa2f..49e9437 100644
@@ -30,6 +30,7 @@
  */
 
 #include <common.h>
+#include <fpga.h>
 #include <virtex2.h>
 #include <spartan2.h>
 #include <spartan3.h>
@@ -58,8 +59,14 @@ int fpga_loadbitstream(int devnum, char *fpgadata, size_t size)
 	char buffer[80];
 	unsigned char *dataptr;
 	unsigned int i;
+	const fpga_desc *desc;
+	Xilinx_desc *xdesc;
 
 	dataptr = (unsigned char *)fpgadata;
+	/* Find out fpga_description */
+	desc = fpga_validate(devnum, dataptr, 0, (char *)__func__);
+	/* Assign xilinx device description */
+	xdesc = desc->devdesc;
 
 	/* skip the first bytes of the bitsteam, their meaning is unknown */
 	length = (*dataptr << 8) + *(dataptr + 1);
@@ -93,6 +100,20 @@ int fpga_loadbitstream(int devnum, char *fpgadata, size_t size)
 	dataptr += 2;
 	for (i = 0; i < length; i++)
 		buffer[i] = *dataptr++;
+
+	if (xdesc->name) {
+		i = strncmp(buffer, xdesc->name, strlen(xdesc->name));
+		if (i) {
+			printf("%s: Wrong bitstream ID for this device\n",
+			       __func__);
+			printf("%s: Bitstream ID %s, current device ID %d/%s\n",
+			       __func__, buffer, devnum, xdesc->name);
+			return FPGA_FAIL;
+		}
+	} else {
+		printf("%s: Please fill correct device ID to Xilinx_desc\n",
+		       __func__);
+	}
 	printf("  part number = \"%s\"\n", buffer);
 
 	/* get date (identifier, length, string) */
@@ -306,6 +327,8 @@ int xilinx_info (Xilinx_desc * desc)
 		printf ("Device Size:   \t%d bytes\n"
 				"Cookie:        \t0x%x (%d)\n",
 				desc->size, desc->cookie, desc->cookie);
+		if (desc->name)
+			printf("Device name:   \t%s\n", desc->name);
 
 		if (desc->iface_fns) {
 			printf ("Device Function Table @ 0x%p\n", desc->iface_fns);
include/fpga.h +2 -0
index 38f62c0..ebefba8 100644
@@ -71,5 +71,7 @@ extern int fpga_load(int devnum, const void *buf, size_t bsize);
 extern int fpga_loadbitstream(int devnum, char *fpgadata, size_t size);
 extern int fpga_dump(int devnum, const void *buf, size_t bsize);
 extern int fpga_info(int devnum);
+extern const fpga_desc *const fpga_validate(int devnum, const void *buf,
+					    size_t bsize, char *fn);
 
 #endif	/* _FPGA_H_ */
include/xilinx.h +1 -0
index 592cbea..bcfe76d 100644
@@ -81,6 +81,7 @@ typedef struct {		/* typedef Xilinx_desc */
 	size_t size;		/* bytes of data part can accept */
 	void *iface_fns;	/* interface function table */
 	int cookie;		/* implementation specific cookie */
+	char *name;		/* device name in bitstream */
 } Xilinx_desc;			/* end, typedef Xilinx_desc */
 
 /* Generic Xilinx Functions
include/zynqpl.h +4 -4
index bc9b948..0247ef6 100644
@@ -45,15 +45,15 @@ extern int zynq_info(Xilinx_desc *desc);
 
 /* Descriptor Macros */
 #define XILINX_XC7Z010_DESC(cookie) \
-{ xilinx_zynq, devcfg, XILINX_XC7Z010_SIZE, NULL, cookie }
+{ xilinx_zynq, devcfg, XILINX_XC7Z010_SIZE, NULL, cookie, "7z010" }
 
 #define XILINX_XC7Z020_DESC(cookie) \
-{ xilinx_zynq, devcfg, XILINX_XC7Z020_SIZE, NULL, cookie }
+{ xilinx_zynq, devcfg, XILINX_XC7Z020_SIZE, NULL, cookie, "7z020" }
 
 #define XILINX_XC7Z030_DESC(cookie) \
-{ xilinx_zynq, devcfg, XILINX_XC7Z030_SIZE, NULL, cookie }
+{ xilinx_zynq, devcfg, XILINX_XC7Z030_SIZE, NULL, cookie, "7z030" }
 
 #define XILINX_XC7Z045_DESC(cookie) \
-{ xilinx_zynq, devcfg, XILINX_XC7Z045_SIZE, NULL, cookie }
+{ xilinx_zynq, devcfg, XILINX_XC7Z045_SIZE, NULL, cookie, "7z045" }
 
 #endif /* _ZYNQPL_H_ */

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130503/4c05923d/attachment.pgp>

#9 lore raw

PATCH v3 9/9 fpga: Remove all CONFIG_SYS_* fpga related options

In reply to Michal Simek

All these macros are completely unused by any code. CONFIG_FPGA is not a bitfield anymore.

---
Changes in v3:
- New patch in this series

Changes in v2: None

 include/altera.h              | 17 -----------------
 include/configs/M54455EVB.h   |  2 +-
 include/configs/MERGERBOX.h   |  2 +-
 include/configs/MVBC_P.h      |  2 +-
 include/configs/MVBLM7.h      |  2 +-
 include/configs/MVSMR.h       |  2 +-
 include/configs/omap3_mvblx.h |  2 +-
 include/fpga.h                | 10 ----------
 include/lattice.h             |  3 ---
 include/xilinx.h              | 24 ------------------------
 10 files changed, 6 insertions(+), 60 deletions(-)
include/altera.h +0 -17
index 7a2bece..6aad5ee 100644
@@ -27,23 +27,6 @@
 #ifndef _ALTERA_H_
 #define _ALTERA_H_
 
-/* Altera Model definitions
- *********************************************************************/
-#define CONFIG_SYS_ACEX1K		CONFIG_SYS_FPGA_DEV( 0x1 )
-#define CONFIG_SYS_CYCLON2		CONFIG_SYS_FPGA_DEV( 0x2 )
-#define CONFIG_SYS_STRATIX_II		CONFIG_SYS_FPGA_DEV( 0x4 )
-
-#define CONFIG_SYS_ALTERA_ACEX1K	(CONFIG_SYS_FPGA_ALTERA | CONFIG_SYS_ACEX1K)
-#define CONFIG_SYS_ALTERA_CYCLON2	(CONFIG_SYS_FPGA_ALTERA | CONFIG_SYS_CYCLON2)
-#define CONFIG_SYS_ALTERA_STRATIX_II	(CONFIG_SYS_FPGA_ALTERA | CONFIG_SYS_STRATIX_II)
-/* Add new models here */
-
-/* Altera Interface definitions
- *********************************************************************/
-#define CONFIG_SYS_ALTERA_IF_PS	CONFIG_SYS_FPGA_IF( 0x1 )	/* passive serial */
-#define CONFIG_SYS_ALTERA_IF_FPP	CONFIG_SYS_FPGA_IF( 0x2 )	/* fast passive parallel */
-/* Add new interfaces here */
-
 typedef enum {				/* typedef Altera_iface */
 	min_altera_iface_type,		/* insert all new types after this */
 	passive_serial,			/* serial data and external clock */
include/configs/M54455EVB.h +1 -1
index 1bc2c5a..536b755 100644
@@ -238,7 +238,7 @@
 
 /* FPGA - Spartan 2 */
 /* experiment
-#define CONFIG_FPGA		CONFIG_SYS_SPARTAN3
+#define CONFIG_FPGA
 #define CONFIG_FPGA_COUNT	1
 #define CONFIG_SYS_FPGA_PROG_FEEDBACK
 #define CONFIG_SYS_FPGA_CHECK_CTRLC
include/configs/MERGERBOX.h +1 -1
index c296e3c..30fb6c2 100644
@@ -606,7 +606,7 @@
  * FPGA
  */
 #define CONFIG_FPGA_COUNT	1
-#define CONFIG_FPGA		CONFIG_SYS_ALTERA_CYCLON2
+#define CONFIG_FPGA
 #define CONFIG_FPGA_ALTERA
 #define CONFIG_FPGA_CYCLON2
 
include/configs/MVBC_P.h +1 -1
index 6850965..7271468 100644
@@ -310,7 +310,7 @@
 
 #undef FPGA_DEBUG
 #undef CONFIG_SYS_FPGA_PROG_FEEDBACK
-#define CONFIG_FPGA		CONFIG_SYS_ALTERA_CYCLON2
+#define CONFIG_FPGA
 #define CONFIG_FPGA_ALTERA	1
 #define CONFIG_FPGA_CYCLON2	1
 #define CONFIG_FPGA_COUNT	1
include/configs/MVBLM7.h +1 -1
index a99ad3c..a9c00ac 100644
@@ -499,7 +499,7 @@
 	""
 
 #define CONFIG_FPGA_COUNT	1
-#define CONFIG_FPGA		CONFIG_SYS_ALTERA_CYCLON2
+#define CONFIG_FPGA
 #define CONFIG_FPGA_ALTERA
 #define CONFIG_FPGA_CYCLON2
 
include/configs/MVSMR.h +1 -1
index bf2f44e..5d2ff14 100644
@@ -280,7 +280,7 @@
 
 #undef FPGA_DEBUG
 #undef CONFIG_SYS_FPGA_PROG_FEEDBACK
-#define CONFIG_FPGA		CONFIG_SYS_XILINX_SPARTAN2
+#define CONFIG_FPGA
 #define CONFIG_FPGA_XILINX	1
 #define CONFIG_FPGA_SPARTAN2	1
 #define CONFIG_FPGA_COUNT	1
include/configs/omap3_mvblx.h +1 -1
index 376a3d0..f9adc01 100644
@@ -273,7 +273,7 @@
 #endif /* (CONFIG_CMD_NET) */
 
 #define CONFIG_FPGA_COUNT	1
-#define CONFIG_FPGA          CONFIG_SYS_ALTERA_CYCLON2
+#define CONFIG_FPGA
 #define CONFIG_FPGA_ALTERA
 #define CONFIG_FPGA_CYCLON2
 #define CONFIG_SYS_FPGA_PROG_FEEDBACK
include/fpga.h +0 -10
index ebefba8..38e9018 100644
@@ -31,16 +31,6 @@
 #define CONFIG_MAX_FPGA_DEVICES		5
 #endif
 
-/* CONFIG_FPGA bit assignments */
-#define CONFIG_SYS_FPGA_MAN(x)		(x)
-#define CONFIG_SYS_FPGA_DEV(x)		((x) << 8 )
-#define CONFIG_SYS_FPGA_IF(x)		((x) << 16 )
-
-/* FPGA Manufacturer bits in CONFIG_FPGA */
-#define CONFIG_SYS_FPGA_XILINX		CONFIG_SYS_FPGA_MAN( 0x1 )
-#define CONFIG_SYS_FPGA_ALTERA		CONFIG_SYS_FPGA_MAN( 0x2 )
-
-
 /* fpga_xxxx function return value definitions */
 #define FPGA_SUCCESS		0
 #define FPGA_FAIL		-1
include/lattice.h +0 -3
index 6a2cf93..49871da 100644
@@ -278,9 +278,6 @@ typedef struct {
 	char		*desc;	/* description string */
 } Lattice_desc;			/* end, typedef Altera_desc */
 
-/* Lattice Model Type */
-#define CONFIG_SYS_XP2		CONFIG_SYS_FPGA_DEV(0x1)
-
 /* Board specific implementation specific function types */
 typedef void (*Lattice_jtag_init)(void);
 typedef void (*Lattice_jtag_set_tdi)(int v);
include/xilinx.h +0 -24
index bcfe76d..9a64771 100644
@@ -27,30 +27,6 @@
 #ifndef _XILINX_H_
 #define _XILINX_H_
 
-/* Xilinx Model definitions
- *********************************************************************/
-#define CONFIG_SYS_SPARTAN2			CONFIG_SYS_FPGA_DEV( 0x1 )
-#define CONFIG_SYS_VIRTEX_E			CONFIG_SYS_FPGA_DEV( 0x2 )
-#define CONFIG_SYS_VIRTEX2			CONFIG_SYS_FPGA_DEV( 0x4 )
-#define CONFIG_SYS_SPARTAN3			CONFIG_SYS_FPGA_DEV( 0x8 )
-#define CONFIG_SYS_ZYNQ				CONFIG_SYS_FPGA_DEV(0x10)
-#define CONFIG_SYS_XILINX_SPARTAN2	(CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_SPARTAN2)
-#define CONFIG_SYS_XILINX_VIRTEX_E	(CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_VIRTEX_E)
-#define CONFIG_SYS_XILINX_VIRTEX2	(CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_VIRTEX2)
-#define CONFIG_SYS_XILINX_SPARTAN3	(CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_SPARTAN3)
-#define CONFIG_SYS_XILINX_ZYNQ	(CONFIG_SYS_FPGA_XILINX | CONFIG_SYS_ZYNQ)
-/* XXX - Add new models here */
-
-
-/* Xilinx Interface definitions
- *********************************************************************/
-#define CONFIG_SYS_XILINX_IF_SS	CONFIG_SYS_FPGA_IF( 0x1 )	/* slave serial		*/
-#define CONFIG_SYS_XILINX_IF_MS	CONFIG_SYS_FPGA_IF( 0x2 )	/* master serial	*/
-#define CONFIG_SYS_XILINX_IF_SP	CONFIG_SYS_FPGA_IF( 0x4 )	/* slave parallel	*/
-#define CONFIG_SYS_XILINX_IF_JTAG	CONFIG_SYS_FPGA_IF( 0x8 )	/* jtag			*/
-#define CONFIG_SYS_XILINX_IF_MSM	CONFIG_SYS_FPGA_IF( 0x10 )	/* master selectmap	*/
-#define CONFIG_SYS_XILINX_IF_SSM	CONFIG_SYS_FPGA_IF( 0x20 )	/* slave selectmap	*/
-
 /* Xilinx types
  *********************************************************************/
 typedef enum {			/* typedef Xilinx_iface */

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130503/7c9856e0/attachment.pgp>

#10 lore raw

v3 cover FPGA cleanup + zynq support

In reply to Michal Simek
Quoted 26 lines · Michal Simek

Fpga code is pretty old and none has tried to clean it up. My attempt is related to new code I want to push to mainline which is add support for checking bitstream and if bitstream is valid for the selected device.
For this I need to do cleanup code and move code from cmd_fpga.c to fpga.c in driver folder.

Zynq driver:
Depends on previous zynq patches sent some days ago.

Tested by:
set fload tftp \${addr} fpga.bin\;fpga info 0\;fpga load 0 \${addr} \${filesize} set floadb tftp \${addr} download.bit\;fpga info 0\;fpga loadb 0 \${addr} \${filesize} set addr 10000000
run fload
run floadb
set addr 10000001
run fload
run floadb
set addr 10000002
run fload
run floadb
set addr 10000003
run fload
run floadb

Quoted 4 lines

Thanks for your comments,
Michal

Changes in v3:

For the series:

Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130503/a16dd772/attachment.pgp>