Commit 3818b677641038d27b2663fbd6771ad38c932f86

Authored by Matthias Fuchs
Committed by Wolfgang Denk
1 parent b4746d8bf9
Exists in master and in 55 other branches 8qm-imx_v2020.04_5.4.70_2.3.0, emb_lf_v2022.04, emb_lf_v2023.04, imx_v2015.04_4.1.15_1.0.0_ga, pitx_8mp_lf_v2020.04, smarc-8m-android-10.0.0_2.6.0, smarc-8m-android-11.0.0_2.0.0, smarc-8mp-android-11.0.0_2.0.0, smarc-emmc-imx_v2014.04_3.10.53_1.1.0_ga, smarc-emmc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx-l5.0.0_1.0.0-ga, smarc-imx6_v2018.03_4.14.98_2.0.0_ga, smarc-imx7_v2017.03_4.9.11_1.0.0_ga, smarc-imx7_v2018.03_4.14.98_2.0.0_ga, smarc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx_v2015.04_4.1.15_1.0.0_ga, smarc-imx_v2017.03_4.9.11_1.0.0_ga, smarc-imx_v2017.03_4.9.88_2.0.0_ga, smarc-imx_v2017.03_o8.1.0_1.3.0_8m, smarc-imx_v2018.03_4.14.78_1.0.0_ga, smarc-m6.0.1_2.1.0-ga, smarc-n7.1.2_2.0.0-ga, smarc-rel_imx_4.1.15_2.0.0_ga, smarc_8m-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8m-imx_v2019.04_4.19.35_1.1.0, smarc_8m_00d0-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2019.04_4.19.35_1.1.0, smarc_8mm-imx_v2020.04_5.4.24_2.1.0, smarc_8mp_lf_v2020.04, smarc_8mq-imx_v2020.04_5.4.24_2.1.0, smarc_8mq_lf_v2020.04, ti-u-boot-2015.07, u-boot-2013.01.y, v2013.10, v2013.10-smarct33, v2013.10-smartmen, v2014.01, v2014.04, v2014.04-smarct33, v2014.04-smarct33-emmc, v2014.04-smartmen, v2014.07, v2014.07-smarct33, v2014.07-smartmen, v2015.07-smarct33, v2015.07-smarct33-emmc, v2015.07-smarct4x, v2016.05-dlt, v2016.05-smarct3x, v2016.05-smarct3x-emmc, v2016.05-smarct4x, v2017.01-smarct3x, v2017.01-smarct3x-emmc, v2017.01-smarct4x

fpga: Fix Spartan II FPGA booting

This patch does some minor fixing of the Xilinx Spartan II
FPGA boot code:

- Fixed call order of post configuration callback and
  success message printing (result of copy-paste?)
- relocate post configuration callback only when it
  is implemented
- remove obsolete comment
- minor coding style cleanup

Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>

Showing 1 changed file with 11 additions and 21 deletions Side-by-side Diff

drivers/fpga/spartan2.c
... ... @@ -260,8 +260,6 @@
260 260 ts = get_timer (0); /* get current time */
261 261 ret_val = FPGA_SUCCESS;
262 262 while ((*fn->done) (cookie) == FPGA_FAIL) {
263   - /* XXX - we should have a check in here somewhere to
264   - * make sure we aren't busy forever... */
265 263  
266 264 CONFIG_FPGA_DELAY ();
267 265 (*fn->clk) (FALSE, TRUE, cookie); /* Deassert the clock pin */
268 266  
269 267  
270 268  
271 269  
272 270  
... ... @@ -276,23 +274,18 @@
276 274 }
277 275 }
278 276  
279   - if (ret_val == FPGA_SUCCESS) {
280   -#ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
281   - puts ("Done.\n");
282   -#endif
283   - }
284 277 /*
285 278 * Run the post configuration function if there is one.
286 279 */
287   - if (*fn->post) {
  280 + if (*fn->post)
288 281 (*fn->post) (cookie);
289   - }
290 282  
291   - else {
292 283 #ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
  284 + if (ret_val == FPGA_SUCCESS)
  285 + puts ("Done.\n");
  286 + else
293 287 puts ("Fail.\n");
294 288 #endif
295   - }
296 289  
297 290 } else {
298 291 printf ("%s: NULL Interface function table!\n", __FUNCTION__);
... ... @@ -412,8 +405,10 @@
412 405 addr = (ulong) (fn->abort) + reloc_offset;
413 406 fn_r->abort = (Xilinx_abort_fn) addr;
414 407  
415   - addr = (ulong) (fn->post) + reloc_offset;
416   - fn_r->post = (Xilinx_post_fn) addr;
  408 + if (fn->post) {
  409 + addr = (ulong) (fn->post) + reloc_offset;
  410 + fn_r->post = (Xilinx_post_fn) addr;
  411 + }
417 412  
418 413 fn_r->relocated = TRUE;
419 414  
... ... @@ -541,8 +536,6 @@
541 536 (*fn->wr) (TRUE, TRUE, cookie);
542 537  
543 538 while (! (*fn->done) (cookie)) {
544   - /* XXX - we should have a check in here somewhere to
545   - * make sure we aren't busy forever... */
546 539  
547 540 CONFIG_FPGA_DELAY ();
548 541 (*fn->clk) (FALSE, TRUE, cookie); /* Deassert the clock pin */
549 542  
550 543  
551 544  
552 545  
... ... @@ -562,17 +555,14 @@
562 555 /*
563 556 * Run the post configuration function if there is one.
564 557 */
565   - if (*fn->post) {
  558 + if (*fn->post)
566 559 (*fn->post) (cookie);
567   - }
568 560  
569 561 #ifdef CONFIG_SYS_FPGA_PROG_FEEDBACK
570   - if (ret_val == FPGA_SUCCESS) {
  562 + if (ret_val == FPGA_SUCCESS)
571 563 puts ("Done.\n");
572   - }
573   - else {
  564 + else
574 565 puts ("Fail.\n");
575   - }
576 566 #endif
577 567  
578 568 } else {