X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=drivers%2Ffpga%2Fxilinx.c;h=49e943718e2a045d93ebb78e6a72ab0db50abbf2;hb=47b8e527448c94d09fc8dbdb6601ea7a605ff955;hp=496aa2f6eb750cf066946e315e3dbe7b9ec1de4a;hpb=d5dae85f23c7c902731512e451afde9a6e4a250a;p=karo-tx-uboot.git diff --git a/drivers/fpga/xilinx.c b/drivers/fpga/xilinx.c index 496aa2f6eb..49e943718e 100644 --- a/drivers/fpga/xilinx.c +++ b/drivers/fpga/xilinx.c @@ -30,6 +30,7 @@ */ #include +#include #include #include #include @@ -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);