[PATCH] arm: socfpga: Ensure FPGA in user mode before enabling the bridges

Maniyam, Dinesh dinesh.maniyam at altera.com
Thu Apr 16 06:14:52 CEST 2026


Hi Tien Fong,

On 15/4/2026 3:47 pm, Chee, Tien Fong wrote:
> Hi Dinesh,
>
> On 4/3/2026 11:43 am, dinesh.maniyam at altera.com wrote:
>> From: Dinesh Maniyam <dinesh.maniyam at altera.com>
>>
>> Unexpected behavior and error can occur if FPGA is accessed in unknown
>> state.Always checking with FPGA in user mode is required to ensure
>> system stability.
>>
>> Signed-off-by: Tien Fong Chee <tien.fong.chee at intel.com>
>> Signed-off-by: Dinesh Maniyam <dinesh.maniyam at altera.com>
>> ---
>>   arch/arm/mach-socfpga/misc_arria10.c | 13 ++++++++++---
>>   1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm/mach-socfpga/misc_arria10.c 
>> b/arch/arm/mach-socfpga/misc_arria10.c
>> index 7e0f3875b7c..6b25ab917ca 100644
>> --- a/arch/arm/mach-socfpga/misc_arria10.c
>> +++ b/arch/arm/mach-socfpga/misc_arria10.c
>> @@ -13,6 +13,7 @@
>>   #include <ns16550.h>
>>   #include <spi_flash.h>
>>   #include <watchdog.h>
>> +#include <asm/arch/fpga_manager.h>
>>   #include <asm/arch/misc.h>
>>   #include <asm/arch/pinmux.h>
>>   #include <asm/arch/reset_manager.h>
>> @@ -126,10 +127,16 @@ int print_cpuinfo(void)
>>     void do_bridge_reset(int enable, unsigned int mask)
>
>
> mask is unused on Arria 10—please mark it __maybe_unused so we do not 
> trip -Wunused-parameter while keeping the shared API.
>
> Example: unsigned int mask __maybe_unused
>
>
>>   {
>> -    if (enable)
>> -        socfpga_reset_deassert_bridges_handoff();
>> -    else
>> +    if (enable) {
>> +        if (is_fpgamgr_user_mode()) {
>> +            socfpga_reset_deassert_bridges_handoff();
>> +        } else {
>> +            puts("Bridges: Failed to enable because FPGA is not ");
>> +            puts("in user mode\n");
>
>
> Single line puts is preferred
>
> Example:
>         puts("Bridges: failed to enable because FPGA is not "
>                 "in user mode\n");
>
> Best regards,
>
> Tien Fong
>

Thanks for the review. I’ll update the patch to mark |mask| as 
|__maybe_unused
|and combine the |puts()| calls as suggested.

Best regards,
Dinesh



More information about the U-Boot mailing list