.. | .. |
---|
12 | 12 | #include <image.h> |
---|
13 | 13 | #include <malloc.h> |
---|
14 | 14 | #include <mtd_blk.h> |
---|
| 15 | +#include <mp_boot.h> |
---|
15 | 16 | #include <spl.h> |
---|
16 | 17 | #include <spl_ab.h> |
---|
17 | 18 | #include <linux/libfdt.h> |
---|
.. | .. |
---|
481 | 482 | #else |
---|
482 | 483 | sector = CONFIG_SPL_KERNEL_BOOT_SECTOR; |
---|
483 | 484 | #endif |
---|
| 485 | + printf("Trying kernel at 0x%x sector from '%s' part\n", sector, part_name); |
---|
| 486 | + |
---|
484 | 487 | if (info->read(info, sector, 1, &fit_header) != 1) { |
---|
485 | 488 | debug("%s: Failed to read header\n", __func__); |
---|
486 | 489 | return -EIO; |
---|
.. | .. |
---|
793 | 796 | int ret = -EINVAL; |
---|
794 | 797 | int i; |
---|
795 | 798 | |
---|
| 799 | +#ifdef CONFIG_MP_BOOT |
---|
| 800 | + mpb_init_1(*info); |
---|
| 801 | +#endif |
---|
| 802 | + |
---|
796 | 803 | printf("Trying fit image at 0x%lx sector\n", sector_offs); |
---|
797 | 804 | for (i = 0; i < CONFIG_SPL_FIT_IMAGE_MULTIPLE; i++) { |
---|
798 | 805 | if (i > 0) { |
---|
.. | .. |
---|
820 | 827 | } |
---|
821 | 828 | } |
---|
822 | 829 | #ifdef CONFIG_SPL_AB |
---|
| 830 | + /* If boot fail in spl, spl must decrease 1 and do_reset. */ |
---|
| 831 | + if (ret) |
---|
| 832 | + return spl_ab_decrease_reset(info->dev); |
---|
823 | 833 | /* |
---|
824 | | - * If boot fail in spl, spl must decrease 1. If boot |
---|
825 | | - * successfully, it is no need to do that and U-boot will |
---|
826 | | - * always to decrease 1. If in thunderboot process, |
---|
827 | | - * always need to decrease 1. |
---|
| 834 | + * If boot successfully, it is no need to do decrease |
---|
| 835 | + * and U-boot will always decrease 1. |
---|
| 836 | + * If in thunderboot process, always need to decrease 1. |
---|
828 | 837 | */ |
---|
829 | | - if (IS_ENABLED(CONFIG_SPL_KERNEL_BOOT) || ret) |
---|
| 838 | + if (spl_image->next_stage == SPL_NEXT_STAGE_KERNEL) |
---|
830 | 839 | spl_ab_decrease_tries(info->dev); |
---|
831 | 840 | #endif |
---|
| 841 | + |
---|
832 | 842 | return ret; |
---|
833 | 843 | } |
---|
834 | 844 | |
---|