[U-Boot] [PATCH] vexpress64: compile Juno PCIe conditionally

Tom Rini trini at konsulko.com
Tue Oct 20 17:38:15 CEST 2015


On Tue, Oct 20, 2015 at 08:05:40AM +0200, Linus Walleij wrote:

> Only compile in PCIe support if the board really uses it. Provide
> a stub for the init function if e.g. FVP is being built.
> 
> Cc: Liviu Dudau <Liviu.Dudau at foss.arm.com>
> Cc: Ryan Harkin <ryan.harkin at linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
>  board/armltd/vexpress64/Makefile | 3 ++-
>  board/armltd/vexpress64/pcie.c   | 2 --
>  board/armltd/vexpress64/pcie.h   | 4 ++++
>  3 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/board/armltd/vexpress64/Makefile b/board/armltd/vexpress64/Makefile
> index a35db401b684..b4391a71249a 100644
> --- a/board/armltd/vexpress64/Makefile
> +++ b/board/armltd/vexpress64/Makefile
> @@ -5,4 +5,5 @@
>  # SPDX-License-Identifier:	GPL-2.0+
>  #
>  
> -obj-y	:= vexpress64.o pcie.o
> +obj-y	:= vexpress64.o
> +obj-$(CONFIG_TARGET_VEXPRESS64_JUNO)	+= pcie.o
> diff --git a/board/armltd/vexpress64/pcie.c b/board/armltd/vexpress64/pcie.c
> index 7b999e8ef40b..311c4500e3ff 100644
> --- a/board/armltd/vexpress64/pcie.c
> +++ b/board/armltd/vexpress64/pcie.c
> @@ -191,7 +191,5 @@ void xr3pci_init(void)
>  
>  void vexpress64_pcie_init(void)
>  {
> -#ifdef CONFIG_TARGET_VEXPRESS64_JUNO
>  	xr3pci_init();
> -#endif
>  }
> diff --git a/board/armltd/vexpress64/pcie.h b/board/armltd/vexpress64/pcie.h
> index 14642f4f5c43..55b276d6af11 100644
> --- a/board/armltd/vexpress64/pcie.h
> +++ b/board/armltd/vexpress64/pcie.h
> @@ -1,6 +1,10 @@
>  #ifndef __VEXPRESS64_PCIE_H__
>  #define __VEXPRESS64_PCIE_H__
>  
> +#ifdef CONFIG_TARGET_VEXPRESS64_JUNO
>  void vexpress64_pcie_init(void);
> +#else
> +static inline void vexpress64_pcie_init(void) {}
> +#endif
>  
>  #endif /* __VEXPRESS64_PCIE_H__ */

Alright, so the versatile platform makes life fun at times.  First, my
preference is for weak functions (and I _think_ the linker ends up being
smart enough about them to optimize things away, if not, arrg).  Second,
the question I have is, is this xr3pci_init() bit really a Juno thing or
a baseboard thing (I assume no) or a going to be the same on the next
Cortex-Asomething module thing?  The way the code stands today a
hypothethical A72-based vexpress64 module would need to call
vexpress64_pcie_init() but not strictly xr3pci_init().  It would be a
little ugly as pcie.c would #if/#elif/#endif the enabler call however so
we could __weak a no-op in board.c and rename pcie.c to juno.c and have
a72codenameboard.c later on with its own function.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151020/0a9f9a53/attachment.sig>


More information about the U-Boot mailing list