"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

drivers: fpga: correct compiler errors and warnings

Errors reported by GCC 14.2 when enabling FPGA commands and
drivers. Also many style fixes as reported by checkpatch.pl on the
diffs. Most changes in stratixII.c which has been reorganized as well
to avoid the top function prototypes.

No functional changes.

Signed-off-by: Pieter Van Trappen <pieter.van.trappen@cern.ch>
Link: https://lore.kernel.org/r/20250708152455.1214487-4-vtpieter@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

authored by

Pieter Van Trappen and committed by
Michal Simek
53a10c8c 5d74cf22

+73 -79
+1 -1
cmd/fpga.c
··· 302 302 303 303 data = image_get_load(hdr); 304 304 305 - if (gunzip((void *)data, ~0UL, (void *)image_buf, 305 + if (gunzip((void *)data, ~0U, (void *)image_buf, 306 306 &image_size) != 0) { 307 307 log_err("Gunzip error\n"); 308 308 return CMD_RET_FAILURE;
+1
drivers/fpga/ACEX1K.c
··· 14 14 #include <log.h> 15 15 #include <ACEX1K.h> /* ACEX device family */ 16 16 #include <linux/delay.h> 17 + #include <time.h> 17 18 18 19 /* Note: The assumption is that we cannot possibly run fast enough to 19 20 * overrun the device (the Slave Parallel mode can free run at 50MHz).
+1
drivers/fpga/ivm_core.c
··· 33 33 #include <linux/string.h> 34 34 #include <malloc.h> 35 35 #include <lattice.h> 36 + #include <vsprintf.h> 36 37 37 38 #define vme_out_char(c) printf("%c", c) 38 39 #define vme_out_hex(c) printf("%x", c)
+2 -2
drivers/fpga/lattice.c
··· 350 350 printf("Unsupported interface type, %d\n", desc->iface); 351 351 } 352 352 353 - printf("Device Size: \t%d bytes\n", 354 - desc->size); 353 + printf("Device Size: \t%zu bytes\n", 354 + desc->size); 355 355 356 356 if (desc->iface_fns) { 357 357 printf("Device Function Table @ 0x%p\n",
+1
drivers/fpga/spartan2.c
··· 9 9 #include <config.h> /* core U-Boot definitions */ 10 10 #include <log.h> 11 11 #include <spartan2.h> /* Spartan-II device family */ 12 + #include <time.h> 12 13 13 14 /* Note: The assumption is that we cannot possibly run fast enough to 14 15 * overrun the device (the Slave Parallel mode can free run at 50MHz).
+61 -71
drivers/fpga/stratixII.c
··· 5 5 */ 6 6 7 7 #include <altera.h> 8 + #include <stratixII.h> 8 9 #include <linux/delay.h> 9 - 10 - int StratixII_ps_fpp_load (Altera_desc * desc, void *buf, size_t bsize, 11 - int isSerial, int isSecure); 12 - int StratixII_ps_fpp_dump (Altera_desc * desc, void *buf, size_t bsize); 13 10 14 11 /****************************************************************/ 15 12 /* Stratix II Generic Implementation */ 16 - int StratixII_load (Altera_desc * desc, void *buf, size_t bsize) 17 - { 18 - int ret_val = FPGA_FAIL; 19 - 20 - switch (desc->iface) { 21 - case passive_serial: 22 - ret_val = StratixII_ps_fpp_load (desc, buf, bsize, 1, 0); 23 - break; 24 - case fast_passive_parallel: 25 - ret_val = StratixII_ps_fpp_load (desc, buf, bsize, 0, 0); 26 - break; 27 - case fast_passive_parallel_security: 28 - ret_val = StratixII_ps_fpp_load (desc, buf, bsize, 0, 1); 29 - break; 30 - 31 - /* Add new interface types here */ 32 - default: 33 - printf ("%s: Unsupported interface type, %d\n", __FUNCTION__, 34 - desc->iface); 35 - } 36 - return ret_val; 37 - } 38 - 39 - int StratixII_dump (Altera_desc * desc, void *buf, size_t bsize) 40 - { 41 - int ret_val = FPGA_FAIL; 42 - 43 - switch (desc->iface) { 44 - case passive_serial: 45 - case fast_passive_parallel: 46 - case fast_passive_parallel_security: 47 - ret_val = StratixII_ps_fpp_dump (desc, buf, bsize); 48 - break; 49 - /* Add new interface types here */ 50 - default: 51 - printf ("%s: Unsupported interface type, %d\n", __FUNCTION__, 52 - desc->iface); 53 - } 54 - return ret_val; 55 - } 56 - 57 - int StratixII_info (Altera_desc * desc) 13 + int StratixII_ps_fpp_dump(Altera_desc *desc, const void *buf, size_t bsize) 58 14 { 59 - return FPGA_SUCCESS; 60 - } 61 - 62 - int StratixII_ps_fpp_dump (Altera_desc * desc, void *buf, size_t bsize) 63 - { 64 - printf ("Stratix II Fast Passive Parallel dump is not implemented\n"); 15 + printf("Stratix II Fast Passive Parallel dump is not implemented\n"); 65 16 return FPGA_FAIL; 66 17 } 67 18 68 - int StratixII_ps_fpp_load (Altera_desc * desc, void *buf, size_t bsize, 69 - int isSerial, int isSecure) 19 + int StratixII_ps_fpp_load(Altera_desc *desc, const void *buf, size_t bsize, 20 + int isSerial, int isSecure) 70 21 { 71 22 altera_board_specific_func *fns; 72 23 int cookie; 73 24 int ret_val = FPGA_FAIL; 74 25 int bytecount; 75 - char *buff = buf; 26 + const char *buff = buf; 76 27 int i; 77 28 78 29 if (!desc) { 79 - printf ("%s(%d) Altera_desc missing\n", __FUNCTION__, __LINE__); 30 + log_err("Altera_desc missing\n"); 80 31 return FPGA_FAIL; 81 32 } 82 33 if (!buff) { 83 - printf ("%s(%d) buffer is missing\n", __FUNCTION__, __LINE__); 34 + log_err("buffer is missing\n"); 84 35 return FPGA_FAIL; 85 36 } 86 37 if (!bsize) { 87 - printf ("%s(%d) size is zero\n", __FUNCTION__, __LINE__); 38 + log_err("size is zero\n"); 88 39 return FPGA_FAIL; 89 40 } 90 41 if (!desc->iface_fns) { 91 - printf 92 - ("%s(%d) Altera_desc function interface table is missing\n", 93 - __FUNCTION__, __LINE__); 42 + log_err("Altera_desc function interface table is missing\n"); 94 43 return FPGA_FAIL; 95 44 } 96 45 fns = (altera_board_specific_func *) (desc->iface_fns); ··· 99 48 if (! 100 49 (fns->config && fns->status && fns->done && fns->data 101 50 && fns->abort)) { 102 - printf 103 - ("%s(%d) Missing some function in the function interface table\n", 104 - __FUNCTION__, __LINE__); 51 + log_err("Missing some function in the function interface table\n"); 105 52 return FPGA_FAIL; 106 53 } 107 54 ··· 124 71 bytecount = 0; 125 72 fns->clk (0, 1, cookie); 126 73 127 - printf ("loading to fpga "); 74 + printf("loading to fpga "); 128 75 while (bytecount < bsize) { 129 76 /* 3.1 check stratix has not signaled us an error */ 130 77 if (fns->status (cookie) != 1) { 131 - printf 132 - ("\n%s(%d) Stratix failed (byte transferred till failure 0x%x)\n", 133 - __FUNCTION__, __LINE__, bytecount); 78 + log_err("\nStratix failed (byte transferred till failure 0x%x)\n", 79 + bytecount); 134 80 fns->abort (cookie); 135 81 return FPGA_FAIL; 136 82 } ··· 162 108 163 109 /* 3.5 while clk is deasserted it is safe to print some progress indication */ 164 110 if ((bytecount % (bsize / 100)) == 0) { 165 - printf ("\b\b\b%02d\%", bytecount * 100 / bsize); 111 + printf("\b\b\b%02zu\%%", bytecount * 100 / bsize); 166 112 } 167 113 } 168 114 ··· 170 116 fns->clk (1, 1, cookie); 171 117 udelay(100); 172 118 if (!fns->done (cookie)) { 173 - printf (" error!.\n"); 119 + printf(" error!.\n"); 174 120 fns->abort (cookie); 175 121 return FPGA_FAIL; 176 122 } else { 177 - printf ("\b\b\b done.\n"); 123 + printf("\b\b\b done.\n"); 178 124 } 179 125 180 126 /* 5. call lower layer post configuration */ ··· 187 133 188 134 return FPGA_SUCCESS; 189 135 } 136 + 137 + int StratixII_load(Altera_desc *desc, const void *buf, size_t size) 138 + { 139 + int ret_val = FPGA_FAIL; 140 + 141 + switch (desc->iface) { 142 + case passive_serial: 143 + ret_val = StratixII_ps_fpp_load(desc, buf, size, 1, 0); 144 + break; 145 + case fast_passive_parallel: 146 + ret_val = StratixII_ps_fpp_load(desc, buf, size, 0, 0); 147 + break; 148 + case fast_passive_parallel_security: 149 + ret_val = StratixII_ps_fpp_load(desc, buf, size, 0, 1); 150 + break; 151 + 152 + /* Add new interface types here */ 153 + default: 154 + log_err("Unsupported interface type, %d\n", desc->iface); 155 + } 156 + return ret_val; 157 + } 158 + 159 + int StratixII_dump(Altera_desc *desc, const void *buf, size_t bsize) 160 + { 161 + int ret_val = FPGA_FAIL; 162 + 163 + switch (desc->iface) { 164 + case passive_serial: 165 + case fast_passive_parallel: 166 + case fast_passive_parallel_security: 167 + ret_val = StratixII_ps_fpp_dump(desc, buf, bsize); 168 + break; 169 + /* Add new interface types here */ 170 + default: 171 + log_err("Unsupported interface type, %d\n", desc->iface); 172 + } 173 + return ret_val; 174 + } 175 + 176 + int StratixII_info(Altera_desc *desc) 177 + { 178 + return FPGA_SUCCESS; 179 + }
+1 -1
drivers/fpga/stratixv.c
··· 48 48 int spi_dev; 49 49 int ret = 0; 50 50 51 - if ((u32)rbf_data & 0x3) { 51 + if ((size_t)rbf_data & 0x3) { 52 52 puts("FPGA: Unaligned data, realign to 32bit boundary.\n"); 53 53 return -EINVAL; 54 54 }
-1
drivers/fpga/versalpl.c
··· 6 6 7 7 #include <cpu_func.h> 8 8 #include <log.h> 9 - #include <asm/arch/sys_proto.h> 10 9 #include <memalign.h> 11 10 #include <versalpl.h> 12 11 #include <zynqmp_firmware.h>
+2
drivers/fpga/virtex2.c
··· 19 19 #include <log.h> 20 20 #include <virtex2.h> 21 21 #include <linux/delay.h> 22 + #include <time.h> 22 23 23 24 /* 24 25 * If the SelectMap interface can be overrun by the processor, enable ··· 301 302 size_t bytecount = 0; 302 303 unsigned char *data = (unsigned char *)buf; 303 304 int cookie = desc->cookie; 305 + unsigned long ts; 304 306 305 307 ret_val = virtex2_slave_pre(fn, cookie); 306 308 if (ret_val != FPGA_SUCCESS)
+3 -3
include/stratixII.h
··· 6 6 #ifndef _STRATIXII_H_ 7 7 #define _STRATIXII_H_ 8 8 9 - extern int StratixII_load (Altera_desc * desc, void *image, size_t size); 10 - extern int StratixII_dump (Altera_desc * desc, void *buf, size_t bsize); 11 - extern int StratixII_info (Altera_desc * desc); 9 + int StratixII_load(Altera_desc *desc, const void *buf, size_t size); 10 + int StratixII_dump(Altera_desc *desc, const void *buf, size_t bsize); 11 + int StratixII_info(Altera_desc *desc); 12 12 13 13 #endif /* _STRATIXII_H_ */