[U-Boot] [PATCH v5 024/101] sandbox: Add PCI driver and test for p2sb

Simon Glass sjg at chromium.org
Tue Nov 26 17:08:01 UTC 2019


Hi Bin,

On Tue, 26 Nov 2019 at 00:39, Bin Meng <bmeng.cn at gmail.com> wrote:
>
> Hi Simon,
>
> On Mon, Nov 25, 2019 at 12:11 PM Simon Glass <sjg at chromium.org> wrote:
> >
> > Add a sandbox driver and PCI-device emulator for p2sb. Also add a test
> > which uses a simple 'adder' driver to test the p2sb functionality.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > Changes in v5: None
> > Changes in v4:
> > - Drop change to message about a missing uclass
> > - Drop empty operations struct since p2sb does not need it
> > - Drop pmic_pm8916 driver name and use a sandbox name instead
> > - Split out mmio changes into a separate patch
> >
> > Changes in v3:
> > - Fix build errors in sandbox_spl, etc
> >
> > Changes in v2: None
> >
> >  arch/sandbox/dts/test.dts          |  13 ++
> >  arch/sandbox/include/asm/test.h    |   1 +
> >  configs/sandbox64_defconfig        |   2 +
> >  configs/sandbox_defconfig          |   3 +-
> >  configs/sandbox_flattree_defconfig |   3 +
> >  configs/sandbox_spl_defconfig      |   2 +
> >  configs/tools-only_defconfig       |   2 +
> >  drivers/misc/Makefile              |   2 +
> >  drivers/misc/p2sb_emul.c           | 272 +++++++++++++++++++++++++++++
> >  drivers/misc/p2sb_sandbox.c        |  40 +++++
> >  drivers/misc/sandbox_adder.c       |  60 +++++++
> >  test/dm/Makefile                   |   1 +
> >  test/dm/p2sb.c                     |  28 +++
> >  13 files changed, 428 insertions(+), 1 deletion(-)
> >  create mode 100644 drivers/misc/p2sb_emul.c
> >  create mode 100644 drivers/misc/p2sb_sandbox.c
> >  create mode 100644 drivers/misc/sandbox_adder.c
> >  create mode 100644 test/dm/p2sb.c

[..]

> > diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
> > index 716096abc5..229e268972 100644
> > --- a/configs/sandbox64_defconfig
> > +++ b/configs/sandbox64_defconfig
> > @@ -83,6 +83,8 @@ CONFIG_DEVRES=y
> >  CONFIG_DEBUG_DEVRES=y
> >  CONFIG_ADC=y
> >  CONFIG_ADC_SANDBOX=y
> > +CONFIG_AXI=y
> > +CONFIG_AXI_SANDBOX=y
>
> Is this needed for this patch, or another patch?

It is actually needed for the sandbox emulation driver
(sandbox_adder.c). I'll update the commit.message.

>
> >  CONFIG_CLK=y
> >  CONFIG_CPU=y
> >  CONFIG_DM_DEMO=y
> > diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
> > index 5a3c4f151d..f3d5c2319a 100644
> > --- a/configs/sandbox_defconfig
> > +++ b/configs/sandbox_defconfig
> > @@ -132,6 +132,8 @@ CONFIG_CROS_EC_I2C=y
> >  CONFIG_CROS_EC_LPC=y
> >  CONFIG_CROS_EC_SANDBOX=y
> >  CONFIG_CROS_EC_SPI=y
> > +CONFIG_IRQ=y
>
> CONFIG_IRQ looks to be another patch.

Yes will move it.

>
> > +CONFIG_P2SB=y
> >  CONFIG_PWRSEQ=y
> >  CONFIG_SPL_PWRSEQ=y
> >  CONFIG_I2C_EEPROM=y
> > @@ -151,7 +153,6 @@ CONFIG_PCI=y
> >  CONFIG_DM_PCI=y
> >  CONFIG_DM_PCI_COMPAT=y
> >  CONFIG_PCI_SANDBOX=y
> > -CONFIG_P2SB=y
>
> Oops. so P2SB is already enabled on Sandbox?

Hmmm, yes, will fix that.

[..]

> > +U_BOOT_PCI_DEVICE(sandbox_p2sb_emul_emul, sandbox_p2sb_emul_supported);
> > diff --git a/drivers/misc/p2sb_sandbox.c b/drivers/misc/p2sb_sandbox.c
> > new file mode 100644
> > index 0000000000..fb4dd786ab
> > --- /dev/null
> > +++ b/drivers/misc/p2sb_sandbox.c
> > @@ -0,0 +1,40 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Sandbox P2SB for testing
> > + *
> > + * Copyright 2019 Google LLC
> > + */
> > +
> > +#define LOG_CATEGORY UCLASS_P2SB
> > +
> > +#include <common.h>
> > +#include <dm.h>
> > +#include <asm/io.h>
> > +#include <p2sb.h>
> > +
> > +struct sandbox_p2sb_priv {
> > +       ulong base;
> > +};
> > +
> > +static int sandbox_p2sb_probe(struct udevice *dev)
> > +{
> > +       struct p2sb_uc_priv *upriv = dev_get_uclass_priv(dev);
> > +
> > +       upriv->mmio_base = dm_pci_read_bar32(dev, 0);
> > +       printf("mmio base %x\n", upriv->mmio_base);
>
> It seems to me this should be a debug() output.

Yes, will fix.

[..]

Regards,
Simon


More information about the U-Boot mailing list