[U-Boot] [PATCH 2/2] vexpress64: Juno: Add initialisation code for Juno R1 PCIe host bridge.

Linus Walleij linus.walleij at linaro.org
Thu Oct 15 16:42:19 CEST 2015


On Fri, Oct 9, 2015 at 3:09 PM, Liviu Dudau <Liviu.Dudau at foss.arm.com> wrote:

> Juno R1 has an XpressRICH3 PCIe host bridge that needs to be initialised
> in order for the Linux kernel to be able to enumerate the bus. Add
> support code here that enables the host bridge, trains the links and
> sets up the Address Translation Tables.
>
> Signed-off-by: Liviu Dudau <Liviu.Dudau at foss.arm.com>

Very nice! Now we (soon) have PCIe on the Juno.

Did you:

- Test with compiling in e.g. network cards and booting off of
  ethernet on PCIe?

- Test what happens with a simple VGA card on PCIe?
  Sometimes the VGA card BIOS need to be initialized using
  an emulator running the x86 ROM and I never got that working
  on anything ARM :( (Maybe PCIe doesn't suffer from this? Just
  vanilla PCI has this problem? What do I know.)

> +#ifdef CONFIG_TARGET_VEXPRESS64_JUNO
> +void xr3pci_set_atr_entry(unsigned long base, unsigned long src_addr,
> +                       unsigned long trsl_addr, int window_size,
> +                       int trsl_param)
> +{
(...)
>  int board_init(void)
>  {
> +#ifdef CONFIG_TARGET_VEXPRESS64_JUNO
(...)
> +#endif
>         return 0;
>  }

> +++ b/board/armltd/vexpress64/vexpress64.h
> @@ -0,0 +1,60 @@
> +#ifndef __VEXPRESS64_H__
> +#define __VEXPRESS64_H__

Instead of peppering with #ifdefs I suggest you do like this:

- Create two new files named
  board/armltd/vexpress64/pcie.c
  board/armltd/vexpress64/pcie.h

- Move all the #defines from the vexpress64.h file into
  the top of the pcie.c file.

- Use the pcie.h file for prototypes + stubs like this:

#ifdef CONFIG_TARGET_VEXPRESS64_JUNO
void vexpress64_pcie_init(void);
#else
static inline void vexpress64_pcie_init(void)
{
}
#endif

Then board_init() can unconditionallt call these functions and
they will be stubbed out if compiled for anything else than Juno.

Yours,
Linus Walleij


More information about the U-Boot mailing list