X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Ffpga%2Ffpga.c;h=26d244354cd60a27d1327bd017e16bea671c87c7;hb=744d9859a71c515118457fecb7a58674b600e81a;hp=5659517793e15f3e6c44cc714efc3c1b227bd843;hpb=cd77dd109c4a439519a78c32eddc42bdebc7a61f;p=u-boot diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c index 5659517793..26d244354c 100644 --- a/drivers/fpga/fpga.c +++ b/drivers/fpga/fpga.c @@ -28,6 +28,7 @@ #include /* core U-Boot definitions */ #include /* xilinx specific definitions */ #include /* altera specific definitions */ +#include #if 0 #define FPGA_DEBUG /* define FPGA_DEBUG to get debug messages */ @@ -51,7 +52,7 @@ 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, void *buf, +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 ); @@ -93,7 +94,7 @@ static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_ge /* fpga_validate * generic parameter checking code */ -static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_validate( int devnum, void *buf, +static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_validate(int devnum, const void *buf, size_t bsize, char *fn ) { fpga_desc * desc = fpga_get_desc( devnum ); @@ -137,6 +138,14 @@ static int fpga_dev_info( int devnum ) ret_val = altera_info( desc->devdesc ); #else fpga_no_sup( (char *)__FUNCTION__, "Altera devices" ); +#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: @@ -203,7 +212,7 @@ int fpga_add( fpga_type devtype, void *desc ) /* * Generic multiplexing code */ -int fpga_load( int devnum, void *buf, size_t bsize ) +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__ ); @@ -222,6 +231,13 @@ int fpga_load( int devnum, void *buf, size_t bsize ) ret_val = altera_load( desc->devdesc, buf, bsize ); #else fpga_no_sup( (char *)__FUNCTION__, "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" ); #endif break; default: @@ -236,7 +252,7 @@ int fpga_load( int devnum, void *buf, size_t bsize ) /* fpga_dump * generic multiplexing code */ -int fpga_dump( int devnum, void *buf, size_t bsize ) +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__ ); @@ -255,6 +271,13 @@ int fpga_dump( int devnum, void *buf, size_t bsize ) ret_val = altera_dump( desc->devdesc, buf, bsize ); #else fpga_no_sup( (char *)__FUNCTION__, "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" ); #endif break; default: