[U-Boot] [PATCH v4] arm: socfpga: fix SPL booting from fpga OnChip RAM

Marek Vasut marex at denx.de
Wed Oct 10 10:49:35 UTC 2018


On 10/10/2018 12:32 PM, Simon Goldschmidt wrote:
> On Wed, Oct 10, 2018 at 12:21 PM Marek Vasut <marex at denx.de> wrote:
>>
>> On 10/10/2018 06:26 AM, Simon Goldschmidt wrote:
>>> This patch prevents disabling the FPGA bridges when
>>> SPL or U-Boot is executed from FPGA onchip RAM.
>>>
>>> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt at gmail.com>
>>> ---
>>>
>>> Changes in v4:
>>> - use an inline function in misc.h to check for the address
>>>   range instead of a macro in base_addr_ac5.h
>>>
>>> Changes in v3:
>>> - use __image_copy_start to check if we are executing from FPGA
>>>
>>> Changes in v2:
>>> - use less ifdefs and more C code for address checks
>>>   (but this gives a checkpatch warning because of comparing two
>>>   upper case constants)
>>> - changed comments
>>>
>>>  arch/arm/mach-socfpga/include/mach/base_addr_ac5.h |  1 +
>>>  arch/arm/mach-socfpga/include/mach/misc.h          |  7 +++++++
>>>  arch/arm/mach-socfpga/misc_gen5.c                  | 10 +++++++++-
>>>  arch/arm/mach-socfpga/spl_gen5.c                   | 10 +++++++---
>>>  4 files changed, 24 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-socfpga/include/mach/base_addr_ac5.h b/arch/arm/mach-socfpga/include/mach/base_addr_ac5.h
>>> index bb9e3faa29..2725e9fcc3 100644
>>> --- a/arch/arm/mach-socfpga/include/mach/base_addr_ac5.h
>>> +++ b/arch/arm/mach-socfpga/include/mach/base_addr_ac5.h
>>> @@ -6,6 +6,7 @@
>>>  #ifndef _SOCFPGA_BASE_ADDRS_H_
>>>  #define _SOCFPGA_BASE_ADDRS_H_
>>>
>>> +#define SOCFPGA_FPGA_SLAVES_ADDRESS  0xc0000000
>>>  #define SOCFPGA_STM_ADDRESS          0xfc000000
>>>  #define SOCFPGA_DAP_ADDRESS          0xff000000
>>>  #define SOCFPGA_EMAC0_ADDRESS                0xff700000
>>> diff --git a/arch/arm/mach-socfpga/include/mach/misc.h b/arch/arm/mach-socfpga/include/mach/misc.h
>>> index 4fc9570a04..e78a86503e 100644
>>> --- a/arch/arm/mach-socfpga/include/mach/misc.h
>>> +++ b/arch/arm/mach-socfpga/include/mach/misc.h
>>> @@ -23,6 +23,13 @@ static inline void socfpga_fpga_add(void) {}
>>>
>>>  #ifdef CONFIG_TARGET_SOCFPGA_GEN5
>>>  void socfpga_sdram_remap_zero(void);
>>> +static inline bool socfpga_is_fpga_slaves_addr(void *addr)
>>> +{
>>
>> Is the inline needed ?
> 
> If it's in this header, yes. As without the inline, you get this compiler
> warnings in files that include misc.h but don't call the function:
> warning: ‘socfpga_is_fpga_slaves_addr’ defined but not used [-Wunused-function]

Ah, got it.

>> btw would it make sense to encode __image_copy_start here and just make
>> it a function like ie.
>>
>> static bool socfpga_is_booting_from_fpga(void) {} ?
> 
> Sure. Do you want me to move it into misc_gen5.c r keep the inline?

Nope, just this. Sorry for pestering you so much.

-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list