oweals/u-boot.git
6 years agoRevert "imx8qxp_mek: Disable CONFIG_DISPLAY_CPUINFO"
Bin Meng [Mon, 12 Nov 2018 15:02:17 +0000 (07:02 -0800)]
Revert "imx8qxp_mek: Disable CONFIG_DISPLAY_CPUINFO"

This reverts commit c5bbfaf05dc8592b479a44df6abaadbab54fec2b.

Disabling CONFIG_DISPLAY_CPUINFO was a temporary solution to get
the v2018.11 release out. Now the merge window opens, revert it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agocpu: sandbox: Add "u-boot, dm-pre-reloc" for all cpu nodes
Bin Meng [Sun, 14 Oct 2018 08:07:20 +0000 (01:07 -0700)]
cpu: sandbox: Add "u-boot, dm-pre-reloc" for all cpu nodes

To support CONFIG_DISPLAY_CPUINFO, add "u-boot,dm-pre-reloc" for
all cpu nodes in Sandbox test.dts.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
6 years agocpu: Add DM_FLAG_PRE_RELOC flag to various cpu drivers
Bin Meng [Sun, 14 Oct 2018 08:07:19 +0000 (01:07 -0700)]
cpu: Add DM_FLAG_PRE_RELOC flag to various cpu drivers

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Reported-by: Stefan Roese <sr@denx.de>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
6 years agodm: doc: Update description of pre-relocation support
Bin Meng [Wed, 24 Oct 2018 13:36:40 +0000 (06:36 -0700)]
dm: doc: Update description of pre-relocation support

Add some description about pre-relocation driver binding, including
usage of DM_FLAG_PRE_RELOC flag and caveats.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agowatchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:39 +0000 (06:36 -0700)]
watchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovideo: simplefb: Remove DM_FLAG_PRE_RELOC flag
Bin Meng [Wed, 24 Oct 2018 13:36:38 +0000 (06:36 -0700)]
video: simplefb: Remove DM_FLAG_PRE_RELOC flag

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agosysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:37 +0000 (06:36 -0700)]
sysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoserial: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:36 +0000 (06:36 -0700)]
serial: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotimer: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:35 +0000 (06:36 -0700)]
timer: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoram: bmips: Remove DM_FLAG_PRE_RELOC flag
Bin Meng [Wed, 24 Oct 2018 13:36:34 +0000 (06:36 -0700)]
ram: bmips: Remove DM_FLAG_PRE_RELOC flag

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agopinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:33 +0000 (06:36 -0700)]
pinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agommc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check
Bin Meng [Wed, 24 Oct 2018 13:36:32 +0000 (06:36 -0700)]
mmc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoi2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check
Bin Meng [Wed, 24 Oct 2018 13:36:31 +0000 (06:36 -0700)]
i2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agogpio: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:30 +0000 (06:36 -0700)]
gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoclk: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:29 +0000 (06:36 -0700)]
clk: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoarm: stm32mp: Remove DM_FLAG_PRE_RELOC flag
Bin Meng [Wed, 24 Oct 2018 13:36:28 +0000 (06:36 -0700)]
arm: stm32mp: Remove DM_FLAG_PRE_RELOC flag

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoserial: ns16550: fix debug uart putc called before init
Simon Goldschmidt [Thu, 9 Aug 2018 19:04:19 +0000 (21:04 +0200)]
serial: ns16550: fix debug uart putc called before init

If _debug_uart_putc() is called before _debug_uart_init(), the
ns16550 debug uart driver hangs in a tight loop waiting for the
tx FIFO to get empty.

As this can happen via a printf sneaking in before the port calls
debug_uart_init(), let's rather ignore characters before the debug
uart is initialized.

This is done by reading the baudrate divisor and aborting if is zero.

Tested on socfpga_cyclone5_socrates.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
6 years agouclass: Use uclass_foreach_dev() macro instead of open coding
Liviu Dudau [Fri, 28 Sep 2018 13:12:55 +0000 (14:12 +0100)]
uclass: Use uclass_foreach_dev() macro instead of open coding

Use the uclass_foreach_dev() macro instead of the open coded version.

Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodoc: Document virtio support
Bin Meng [Mon, 15 Oct 2018 09:21:27 +0000 (02:21 -0700)]
doc: Document virtio support

Add REAME.virtio to describe the information about U-Boot support for
VirtIO devices, including supported boards, build instructions, driver
details etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotest: dm: virtio: Add test cases for virtio uclass
Bin Meng [Mon, 15 Oct 2018 09:21:26 +0000 (02:21 -0700)]
test: dm: virtio: Add test cases for virtio uclass

Now that we have a sandbox virtio transport driver, add some test
cases to test virtio uclass driver.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: Add a Sandbox transport driver
Bin Meng [Mon, 15 Oct 2018 09:21:25 +0000 (02:21 -0700)]
virtio: Add a Sandbox transport driver

This driver provides support for Sandbox implementation of virtio
transport driver which is used for testing purpose only.

Two drivers are provided. The 2nd one is a driver that lacks the
'notify' op.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: net: Support non-legacy device
Bin Meng [Mon, 15 Oct 2018 09:21:24 +0000 (02:21 -0700)]
virtio: net: Support non-legacy device

For v1.0 compliant device, it always assumes the member 'num_buffers'
exists in the struct virtio_net_hdr while the legacy driver only
presented 'num_buffers' when VIRTIO_NET_F_MRG_RXBUF was negotiated.
Without that feature the structure was 2 bytes shorter.

Update the driver to support the non-legacy device.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: pci: Support non-legacy PCI transport device
Bin Meng [Mon, 15 Oct 2018 09:21:23 +0000 (02:21 -0700)]
virtio: pci: Support non-legacy PCI transport device

By default QEMU creates legacy PCI transport devices, but we can
ask QEMU to create non-legacy one if we pass additional device
property/value pairs in the command line:

  -device virtio-blk-pci,disable-legacy=true,disable-modern=false

This adds a new driver driver to support non-legacy (modern) device
mode. Previous driver/file name is changed accordingly.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotest: dm: pci: Add cases for finding next PCI capability APIs
Bin Meng [Mon, 15 Oct 2018 09:21:22 +0000 (02:21 -0700)]
test: dm: pci: Add cases for finding next PCI capability APIs

Add test cases to cover the two newly added PCI APIs:
dm_pci_find_next_capability() & dm_pci_find_next_ext_capability().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: pci: Add APIs to find next capability and extended capability
Bin Meng [Mon, 15 Oct 2018 09:21:21 +0000 (02:21 -0700)]
dm: pci: Add APIs to find next capability and extended capability

This introduces two new APIs dm_pci_find_next_capability() and
dm_pci_find_next_ext_capability() to get PCI capability address
and PCI express extended capability address for a given PCI device
starting from a given offset.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: qemu: Imply virtio PCI transport and device drivers
Bin Meng [Mon, 15 Oct 2018 09:21:20 +0000 (02:21 -0700)]
x86: qemu: Imply virtio PCI transport and device drivers

Add virtio drivers for QEMU x86 targets.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoarm: qemu: Enumerate virtio bus during early boot
Bin Meng [Mon, 15 Oct 2018 09:21:19 +0000 (02:21 -0700)]
arm: qemu: Enumerate virtio bus during early boot

Currently devices on the virtio bus is not automatically enumerated,
which means peripherals on the virtio bus are not discovered by their
drivers. This uses board_init() to do the virtio enumeration.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoarm: qemu: Add a Kconfig in the board directory
Bin Meng [Mon, 15 Oct 2018 09:21:18 +0000 (02:21 -0700)]
arm: qemu: Add a Kconfig in the board directory

This adds a Kconfig file in the board directory, so that some
board-specific options can be specified there.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: Add virtio over pci transport driver
Bin Meng [Mon, 15 Oct 2018 09:21:17 +0000 (02:21 -0700)]
virtio: Add virtio over pci transport driver

This adds a transport driver that implements UCLASS_VIRTIO for
virtio over pci, which is commonly used on x86.

It only supports the legacy interface of the pci transport, which
is the default device that QEMU emulates.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: Implement arch-specific io accessor routines
Bin Meng [Mon, 15 Oct 2018 09:21:16 +0000 (02:21 -0700)]
x86: Implement arch-specific io accessor routines

At present the generic io{read,write}{8,16,32} routines only support
MMIO access. With architecture like x86 that has a separate IO space,
these routines cannot be used to access I/O ports.

Implement x86-specific version to support both PIO and MMIO access,
so that drivers for multiple architectures can use these accessors
without the need to know whether it's MMIO or PIO.

These are ported from Linux kernel lib/iomap.c, with slight changes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agokconfig: Introduce HAVE_ARCH_IOMAP
Bin Meng [Mon, 15 Oct 2018 09:21:15 +0000 (02:21 -0700)]
kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoriscv: qemu: Include some useful commands
Bin Meng [Mon, 15 Oct 2018 09:21:14 +0000 (02:21 -0700)]
riscv: qemu: Include some useful commands

With the virtio net and blk drivers, we can do more stuff with some
useful commands. Imply those in the board Kconfig.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoriscv: qemu: Enumerate virtio bus during early boot
Bin Meng [Mon, 15 Oct 2018 09:21:13 +0000 (02:21 -0700)]
riscv: qemu: Enumerate virtio bus during early boot

Currently devices on the virtio bus is not automatically enumerated,
which means peripherals on the virtio bus are not discovered by their
drivers. This uses board_init() to do the virtio enumeration.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: cmd: Add virtio command for virtio devices
Tuomas Tynkkynen [Mon, 15 Oct 2018 09:21:12 +0000 (02:21 -0700)]
virtio: cmd: Add virtio command for virtio devices

Add 'virtio' command in U-Boot command line.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: Add block driver support
Tuomas Tynkkynen [Mon, 15 Oct 2018 09:21:11 +0000 (02:21 -0700)]
virtio: Add block driver support

This adds virtio block device driver support.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoblk: Introduce IF_TYPE_VIRTIO
Tuomas Tynkkynen [Mon, 15 Oct 2018 09:21:10 +0000 (02:21 -0700)]
blk: Introduce IF_TYPE_VIRTIO

This adds a new block interface type for VirtIO block devices.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoblk: Make blk_next_free_devnum() public
Bin Meng [Mon, 15 Oct 2018 09:21:09 +0000 (02:21 -0700)]
blk: Make blk_next_free_devnum() public

blk_next_free_devnum() can be helpful in some cases. Make it
a public API.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoblk: Drop blk_prepare_device()
Bin Meng [Mon, 15 Oct 2018 09:21:08 +0000 (02:21 -0700)]
blk: Drop blk_prepare_device()

With the post_probe() changes, this API is no longer needed.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoblk: Call part_init() in the post_probe() method
Bin Meng [Mon, 15 Oct 2018 09:21:07 +0000 (02:21 -0700)]
blk: Call part_init() in the post_probe() method

part_init() is currently called in every DM BLK driver, either
in its bind() or probe() method. However we can use the BLK
uclass driver's post_probe() method to do it automatically.

Update all DM BLK drivers to adopt this change.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoefi_driver: blk: Switch to use platdata_auto_alloc_size for the driver data
Bin Meng [Mon, 15 Oct 2018 09:21:06 +0000 (02:21 -0700)]
efi_driver: blk: Switch to use platdata_auto_alloc_size for the driver data

Currently the efi block driver uses priv_auto_alloc_size for the
driver data, however that's only available after the device probe
phase. In order to make it accessible in an earlier phase, switch
to use platdata_auto_alloc_size instead.

This patch is the prerequisite for the follow up patch of DM BLK
driver changes to work with EFI loader.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: blk: Switch to use platdata_auto_alloc_size for the driver data
Bin Meng [Mon, 15 Oct 2018 09:21:05 +0000 (02:21 -0700)]
sandbox: blk: Switch to use platdata_auto_alloc_size for the driver data

Currently the sandbox block driver uses priv_auto_alloc_size for
the driver data, however that's only available after the device
probe phase. In order to make it accessible in an earlier phase,
switch to use platdata_auto_alloc_size instead.

This patch is the prerequisite for the follow up patch of DM BLK
driver changes to work with Sandbox.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotest: dm: blk: Correct blk_base test case
Bin Meng [Mon, 15 Oct 2018 09:21:04 +0000 (02:21 -0700)]
test: dm: blk: Correct blk_base test case

The blk_base test case creates a USB mass storage block device with
the Sandbox host block device as its parent. This does not make any
sense and causes potential issue, for example if the test case tries
to read/write anything on the USB mass storage block device it will
definitely fail as its parent is not on USB bus at all.

Correct the test case by creating another Sandbox host block device
instead of the USB mass storage one and adjust the case accordingly.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: Add net driver support
Tuomas Tynkkynen [Mon, 15 Oct 2018 09:21:03 +0000 (02:21 -0700)]
virtio: Add net driver support

This adds virtio net device driver support.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: Add virtio over mmio transport driver
Bin Meng [Mon, 15 Oct 2018 09:21:02 +0000 (02:21 -0700)]
virtio: Add virtio over mmio transport driver

VirtIO can use various different buses and virtio devices are
commonly implemented as PCI devices. But virtual environments
without PCI support (a common situation in embedded devices
models) might use simple memory mapped device (“virtio-mmio”)
instead of the PCI device.

This adds a transport driver that implements UCLASS_VIRTIO for
virtio over mmio.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: Add codes for virtual queue/ring management
Tuomas Tynkkynen [Mon, 15 Oct 2018 09:21:01 +0000 (02:21 -0700)]
virtio: Add codes for virtual queue/ring management

This adds support for managing virtual queue/ring, the channel
for high performance I/O between host and guest.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: Add a new uclass driver for VirtIO transport devices
Bin Meng [Mon, 15 Oct 2018 09:21:00 +0000 (02:21 -0700)]
dm: Add a new uclass driver for VirtIO transport devices

This adds a new virtio uclass driver for “virtio” [1] family of
devices that are are found in virtual environments like QEMU,
yet by design they look like physical devices to the guest.

The uclass driver provides child_pre_probe() and child_post_probe()
methods to do some common operations for virtio device drivers like
device and driver supported feature negotiation, etc.

[1] http://docs.oasis-open.org/virtio/virtio/v1.0/virtio-v1.0.pdf

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoriscv: bootm: Add dm_remove_devices_flags() call to do_bootm_linux()
Bin Meng [Mon, 15 Oct 2018 09:20:59 +0000 (02:20 -0700)]
riscv: bootm: Add dm_remove_devices_flags() call to do_bootm_linux()

This adds a call to dm_remove_devices_flags() to do_bootm_linux()
so that drivers that have one of the removal flags set (e.g.
DM_FLAG_ACTIVE_DMA_REMOVE) in their driver struct, may do some
last-stage cleanup before the OS is started.

arm and x86 already did such, and we should do the same for riscv.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotest: dm: core: Add test case for uclass driver's child_post_probe()
Bin Meng [Mon, 15 Oct 2018 09:20:58 +0000 (02:20 -0700)]
test: dm: core: Add test case for uclass driver's child_post_probe()

Add test case to cover uclass driver's child_post_probe() method.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: Allow uclass to set up a device's child after it is probed
Bin Meng [Mon, 15 Oct 2018 09:20:57 +0000 (02:20 -0700)]
dm: core: Allow uclass to set up a device's child after it is probed

Some buses need to set up their child devices after they are probed.
Support a common child_post_probe() method for the uclass.

With this change, the two APIs uclass_pre_probe_device() and
uclass_post_probe_device() become symmetric.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoregmap: Add overview documentation
Mario Six [Mon, 15 Oct 2018 07:24:15 +0000 (09:24 +0200)]
regmap: Add overview documentation

Add some overview documentation that explains the purpose and some of
the features and limitations of the regmap interface.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoregmap: Add endianness support
Mario Six [Mon, 15 Oct 2018 07:24:14 +0000 (09:24 +0200)]
regmap: Add endianness support

Add support for switching the endianness of regmap accesses via the
"little-endian", "big-endian", and "native-endian" boolean properties in
the device tree.

The default endianness is native endianness.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agotest: regmap: Add test for regmap_{set, get}
Mario Six [Mon, 15 Oct 2018 07:24:13 +0000 (09:24 +0200)]
test: regmap: Add test for regmap_{set, get}

Add test for regmap_{set,get} functions.

Reviewed-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoregmap: Define regmap_{get,set}
Mario Six [Mon, 15 Oct 2018 07:24:12 +0000 (09:24 +0200)]
regmap: Define regmap_{get,set}

It would be convenient if one could use the regmap API in conjunction
with register maps defined as structs (i.e. structs that directly mirror
the memory layout of the registers in question). A similar approach was
planned with the regmap_write32/regmap_read32 macros, but was never
used.

Hence, implement regmap_set/regmap_range_set and
regmap_get/regmap_range_get macros, which, given a register map, a
struct describing the layout of the register map, and a member name
automatically produce regmap_read/regmap_write calls that access the
specified member in the register map.

Reviewed-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoregmap: Support reading from specific range
Mario Six [Mon, 15 Oct 2018 07:24:11 +0000 (09:24 +0200)]
regmap: Support reading from specific range

It is useful to be able to treat the different ranges of a regmap
separately to be able to use distinct offset for them, but this is
currently not implemented in the regmap API.

To preserve backwards compatibility, add regmap_read_range and
regmap_write_range functions that take an additional parameter
'range_num' that identifies the range to operate on.

Reviewed-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoregmap: Add raw read/write functions
Mario Six [Mon, 15 Oct 2018 07:24:10 +0000 (09:24 +0200)]
regmap: Add raw read/write functions

The regmap functions currently assume that all register map accesses
have a data width of 32 bits, but there are maps that have different
widths.

To rectify this, implement the regmap_raw_read and regmap_raw_write
functions from the Linux kernel API that specify the width of a desired
read or write operation on a regmap.

Implement the regmap_read and regmap_write functions using these raw
functions in a backwards-compatible manner.

Reviewed-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agomips: Implement {in, out}_{le, be}_{16, 32, 64} and {in, out}_8
Mario Six [Mon, 15 Oct 2018 07:24:09 +0000 (09:24 +0200)]
mips: Implement {in, out}_{le, be}_{16, 32, 64} and {in, out}_8

MIPS is the only architecture currently supported by U-Boot that does
not implement any of the in/out register access functions.

To have a interface that is useable across architectures, add the
functions to the MIPS architecture (implemented using the __raw_write
and __raw_read functions).

Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoregmap: Add error output
Mario Six [Mon, 15 Oct 2018 07:24:08 +0000 (09:24 +0200)]
regmap: Add error output

Add some debug output in cases where the initialization of a regmap
fails.

Reviewed-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoregmap: Introduce init_range
Mario Six [Mon, 15 Oct 2018 07:24:07 +0000 (09:24 +0200)]
regmap: Introduce init_range

Both fdtdec_get_addr_size_fixed and of_address_to_resource can fail with
an error, which is not currently checked during regmap initialization.

Since the indentation depth is already quite deep, extract a new
'init_range' method to do the initialization.

Reviewed-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agobuildman: Add a --boards option to specify particular boards to build
Simon Glass [Tue, 12 Jun 2018 05:26:46 +0000 (23:26 -0600)]
buildman: Add a --boards option to specify particular boards to build

At present 'buildman sandbox' will build all 5 boards for the sandbox
architecture rather than the single board 'sandbox'. The only current way
to exclude sandbox_spl, sandbox_noblk, etc. is to use -x which is a bit
clumbsy.

Add a --boards option to allow individual build targets to be specified.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Try to start the RAM buffer at a particular address
Simon Glass [Sun, 17 Jun 2018 14:57:43 +0000 (08:57 -0600)]
sandbox: Try to start the RAM buffer at a particular address

Use a starting address of 256MB which should be available. This helps to
make sandbox RAM buffers pointers more recognisable.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agocore: ofnode: Fix mem leak in error path
Mario Six [Thu, 4 Oct 2018 07:22:24 +0000 (09:22 +0200)]
core: ofnode: Fix mem leak in error path

A newly created property is currently not freed if a name could not be
allocated. This patch fixes the resulting memory leak in the error
patch.

Reported-by: Coverity (CID: 184085)
Fixes: e369e58df79c ("core: Add functions to set properties in live-tree")
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agomisc: Add IHS FPGA driver
Mario Six [Thu, 4 Oct 2018 07:00:55 +0000 (09:00 +0200)]
misc: Add IHS FPGA driver

Add a driver for gdsys IHS (Integrated Hardware Systems) FPGAs, which
supports initialization of the FPGA, as well as information gathering.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agomisc: Add gdsys_soc driver
Mario Six [Thu, 4 Oct 2018 07:00:54 +0000 (09:00 +0200)]
misc: Add gdsys_soc driver

This patch adds a driver for the bus associated with a IHS FPGA.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agomisc: Sort Makefile entries
Mario Six [Thu, 4 Oct 2018 07:00:53 +0000 (09:00 +0200)]
misc: Sort Makefile entries

Makefile entries should be sorted.

Reviewed-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
6 years agoregmap: Improve error handling
Mario Six [Thu, 4 Oct 2018 07:00:43 +0000 (09:00 +0200)]
regmap: Improve error handling

ofnode_read_simple_addr_cells may fail and return a negative error code.
Check for this when initializing regmaps.

Also check if both_len is zero, since this is perfectly possible, and
would lead to a division-by-zero further down the line.

Reviewed-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoregmap: Add documentation
Mario Six [Thu, 4 Oct 2018 07:00:42 +0000 (09:00 +0200)]
regmap: Add documentation

Document the regmap_alloc() function.

Reviewed-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoregmap: Fix documentation
Mario Six [Thu, 4 Oct 2018 07:00:41 +0000 (09:00 +0200)]
regmap: Fix documentation

The documentation in regmap.h is not in kernel-doc format. Correct this.

Reviewed-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agotest: regmap: Increase size of syscon0 memory
Mario Six [Thu, 4 Oct 2018 07:00:40 +0000 (09:00 +0200)]
test: regmap: Increase size of syscon0 memory

The upcoming changes to the regmap interface will contain a proper check
for plausibility when reading/writing from/to a register map. To still
have the current tests pass, increase the size of the memory region for
the syscon0 device, since one of the tests reads and writes beyond this
range.

Reviewed-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agotimer: Sort Kconfig driver entries
Bin Meng [Thu, 11 Oct 2018 05:07:02 +0000 (22:07 -0700)]
timer: Sort Kconfig driver entries

This is currently out of order. Sort it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotest: dm: core: Add a test case for driver marked with DM_FLAG_PRE_RELOC flag
Bin Meng [Thu, 11 Oct 2018 05:07:01 +0000 (22:07 -0700)]
test: dm: core: Add a test case for driver marked with DM_FLAG_PRE_RELOC flag

Now that we fixed the pre-relocation driver binding for driver marked
with DM_FLAG_PRE_RELOC flag, add a test case to cover that scenario.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: Mirror the chosen node parse logic in the livetree scanning
Bin Meng [Thu, 11 Oct 2018 05:07:00 +0000 (22:07 -0700)]
dm: core: Mirror the chosen node parse logic in the livetree scanning

Commit f2006808f099: ("dm: core: parse chosen node") added a logic
to parse the chosen node during dm_scan_fdt_node(), but unfortunately
it missed adding the same logic in dm_scan_fdt_live(). This mirrors
the logic in the livetree version.

The weird thing is that commit f2006808f099 did update the test case
to test such logic, but even if I reset to that commit, the test case
still fails, and I have no idea how it could pass.

With this fix, the following 2 test cases now pass:

Test: dm_test_bus_children: bus.c
test/dm/bus.c:112, dm_test_bus_children(): num_devices ==
list_count_items(&uc->dev_head): Expected 7, got 6

Test: dm_test_fdt: test-fdt.c
test/dm/test-fdt.c:184, dm_test_fdt(): num_devices ==
list_count_items(&uc->dev_head): Expected 7, got 6

Fixes: f2006808f099 ("dm: core: parse chosen node")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: Correct pre_reloc_only parameter description in several APIs' comments
Bin Meng [Thu, 11 Oct 2018 05:06:59 +0000 (22:06 -0700)]
dm: Correct pre_reloc_only parameter description in several APIs' comments

The pre_reloc_only parameter description currently only mentions
drivers with the DM_FLAG_PRE_RELOC flag, but does not mention the
special device tree properties. Correct them.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()
Bin Meng [Thu, 11 Oct 2018 05:06:58 +0000 (22:06 -0700)]
dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()

Currently the comments of several APIs (eg: dm_init_and_scan()) say:

@pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC
flag. If false bind all drivers.

The 'Pre-Relocation Support' chapter in doc/driver-model/README.txt
documents the same that both device tree properties and driver flag
are supported.

However the implementation only checks these special device tree
properties without checking the driver flag at all. This updates
lists_bind_fdt() to consider both scenarios.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Squashed in http://patchwork.ozlabs.org/patch/996473/ :
Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: util: Add a livetree equivalent API of dm_fdt_pre_reloc()
Bin Meng [Thu, 11 Oct 2018 05:06:57 +0000 (22:06 -0700)]
dm: util: Add a livetree equivalent API of dm_fdt_pre_reloc()

This adds a new API dm_ofnode_pre_reloc(), a livetree equivalent
API of dm_fdt_pre_reloc().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agocpu: mpc83xx: Remove unnecessary characters in the description string
Bin Meng [Thu, 11 Oct 2018 05:06:56 +0000 (22:06 -0700)]
cpu: mpc83xx: Remove unnecessary characters in the description string

The description string should not contain unnecessary characters,
like the ending '\n' or the leading 'CPU:'.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: cpu: Fix print_cpuinfo() output
Bin Meng [Thu, 11 Oct 2018 05:06:55 +0000 (22:06 -0700)]
dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoboard_f: Use static print_cpuinfo if CONFIG_CPU is active
Mario Six [Mon, 6 Aug 2018 08:23:41 +0000 (10:23 +0200)]
board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoMerge branch 'next'
Tom Rini [Wed, 14 Nov 2018 16:30:07 +0000 (11:30 -0500)]
Merge branch 'next'

This brings in the u-boot-net PR from Joe.

6 years agoPrepare v2018.11 v2018.11
Tom Rini [Wed, 14 Nov 2018 16:10:06 +0000 (11:10 -0500)]
Prepare v2018.11

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agogpio: pca953x_gpio: fix DT GPIO flags translation
Anatolij Gustschin [Thu, 18 Oct 2018 14:15:39 +0000 (16:15 +0200)]
gpio: pca953x_gpio: fix DT GPIO flags translation

Commit fb01e07a95 accidentally broke initialisation of GPIO
descriptor flags from device tree: currently the active low
flag from gpio-specifier is always ignored. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
6 years agoconfigs: Migrate and re-enabled CONFIG_CMD_MTDPARTS
Tom Rini [Wed, 14 Nov 2018 00:54:45 +0000 (19:54 -0500)]
configs: Migrate and re-enabled CONFIG_CMD_MTDPARTS

Now that CMD_UBI does not select CMD_MTDPARTS we need to make platforms
that had been enabling it turn it on by hand.  This exposed that we had
not yet migrated CMD_MTDPARTS fully, so do so now.

Fixes: 86dfa556d927 ("cmd: ubi: Remove useless call to mtdparts_init()")
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-spi
Tom Rini [Wed, 14 Nov 2018 00:50:01 +0000 (19:50 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-spi

6 years agoconfigs: Resync with savedefconfig
Tom Rini [Wed, 14 Nov 2018 00:44:53 +0000 (19:44 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agomtd: Drop duplicate MTD_PARTITIONS Kconfig option
Boris Brezillon [Tue, 13 Nov 2018 11:43:13 +0000 (12:43 +0100)]
mtd: Drop duplicate MTD_PARTITIONS Kconfig option

Commit 9c5b00973bce ("Convert CONFIG_MTD_PARTITIONS et al to Kconfig")
introduced a publicly visible Kconfig entry for the
CONFIG_MTD_PARTITIONS option, while the rework on MTD partitioning
was in progress, and we somehow did not notice that the same Kconfig
entry was added by commit 4048a5c519a8 ("mtd: declare MTD_PARTITIONS
symbol in Kconfig"), but this time as an invisible entry (this can
only be selected by other options).

Keep the non-visible version of this symbol, since MTD_PARTITIONS is
not something the user should be able to enable/disable directly.

Fixes: 4048a5c519a8 ("mtd: declare MTD_PARTITIONS symbol in Kconfig")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agocmd: ubi: Remove useless call to mtdparts_init()
Boris Brezillon [Tue, 13 Nov 2018 11:43:12 +0000 (12:43 +0100)]
cmd: ubi: Remove useless call to mtdparts_init()

Commit c58fb2cdb3e4 ("cmd: ubi: clean the partition handling")
introduced a call to mtd_probe_devices() in the ubi_attach() path
and this function takes care of parsing mtdparts/mtdids and
creating/registering the associated mtd partitions.

The mtdparts_init() call in the ubi_detach() path is not only
unnecessary but can sometimes print error messages even when things
work properly (that's the case with SPI NAND devices that have not
been probed with 'mtd list'), which is misleading.

Remove this call to mtdparts_init() and drop the dependency on
CMD_MTDPARTS.

Fixes: c58fb2cdb3e4 ("cmd: ubi: clean the partition handling")
Reported-by: Stefan Roese <sr@denx.de>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agomtd: Make {MTDIDS, MTDPARTS}_DEFAULT visible when MTD_PARTITIONS is selected
Boris Brezillon [Tue, 13 Nov 2018 11:43:11 +0000 (12:43 +0100)]
mtd: Make {MTDIDS, MTDPARTS}_DEFAULT visible when MTD_PARTITIONS is selected

gwventana configs are relying on CMD_UBI to select CMD_MTDPARTS,
which is then making {MTDIDS,MTDPARTS}_DEFAULT options available.

We are about to remove the 'select CMD_MTDPARTS' statement in the
CMD_UBI entry, but if we do that without first making sure
{MTDIDS,MTDPARTS}_DEFAULT are visible, we end up with a build
failure when building gwventana configs.

Address that by adding a depends on MTD_PARTITIONS to
{MTDIDS,MTDPARTS}_DEFAULT which does the trick since CMD_UBI selects
MTD_UBI which in turn selects MTD_PARTITIONS.

We also get rid of the depends on CMD_MTD, since CMD_MTD also selects
MTD_PARTITIONS.

Reported-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agodfu: nand: Add missing dependency on CMD_MTDPARTS
Boris Brezillon [Tue, 13 Nov 2018 11:43:10 +0000 (12:43 +0100)]
dfu: nand: Add missing dependency on CMD_MTDPARTS

dfu_fill_entity_nand() uses find_dev_and_part() and mtdparts_init()
which are provided by cmd/mtdparts.c.

Add the dependency to avoid build failures when CMD_MTDPARTS is not
selected.

Reported-by: Jagan Teki <jagan@amarulasolutions.com>
Fixes: 6828e602b722d ("dfu: Migrate to Kconfig")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agomtd: Use default mtdparts/mtids when not defined in the environment
Boris Brezillon [Tue, 13 Nov 2018 11:43:09 +0000 (12:43 +0100)]
mtd: Use default mtdparts/mtids when not defined in the environment

U-boot provides a mean to define default values for mtdids and mtdparts
when they're not defined in the environment. Patch mtd_probe_devices()
to use those default values when env_get("mtdparts") or
env_get("mtdids") return NULL.

This implementation is based on the logic found in cmd/mtdparts.c.

Fixes: 5db66b3aee6f ("cmd: mtd: add 'mtd' command")
Reported-by: Stefan Roese <sr@denx.de>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agoMerge tag 'u-boot-imx-20181112' of git://git.denx.de/u-boot-imx
Tom Rini [Mon, 12 Nov 2018 13:06:34 +0000 (08:06 -0500)]
Merge tag 'u-boot-imx-20181112' of git://git.denx.de/u-boot-imx

Fix build vf boards + fix gpr_init()

6 years agoimx: mkimage: add size check to the u-boot.imx make target
Marcel Ziswiler [Fri, 9 Nov 2018 14:31:17 +0000 (15:31 +0100)]
imx: mkimage: add size check to the u-boot.imx make target

The make macro to check if the binary exceeds the board size limit is
taken straight from the root Makefile.

Without this and e.g. enabled EFI Vybrid fails booting as the regular
size limit check does not take the final u-boot.imx binary size into
account which is bigger due to alignment as well as IMX header stuff.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
6 years agoboard: toradex: colibri_vf: drop SPI support
Marcel Ziswiler [Fri, 9 Nov 2018 14:31:16 +0000 (15:31 +0100)]
board: toradex: colibri_vf: drop SPI support

Drop SPI support saving precious 4 Kb on boards with tough size
restrictions.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
6 years agoboard: toradex: colibri_vf: unset CONFIG_CMDLINE_EDITING
Marcel Ziswiler [Fri, 9 Nov 2018 14:31:15 +0000 (15:31 +0100)]
board: toradex: colibri_vf: unset CONFIG_CMDLINE_EDITING

Unset CONFIG_CMDLINE_EDITING saving precious 4 Kb on boards with tough
size restrictions.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoboard: toradex: colibri_vf: efi_loader: unset CONFIG_EFI_UNICODE_CAPITALIZATION
Marcel Ziswiler [Fri, 9 Nov 2018 14:31:14 +0000 (15:31 +0100)]
board: toradex: colibri_vf: efi_loader: unset CONFIG_EFI_UNICODE_CAPITALIZATION

Unset CONFIG_EFI_UNICODE_CAPITALIZATION on boards with tough size
restrictions.

This is analogous to commit a90bf07afc43
("efi_loader: unset CONFIG_EFI_UNICODE_CAPITALIZATION").

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
6 years agommc: dw_mmc: Add RCRC handling
Marek Vasut [Tue, 6 Nov 2018 22:42:11 +0000 (23:42 +0100)]
mmc: dw_mmc: Add RCRC handling

This patch adds check for command response CRC failure. The driver
is currently ignoring CRC check failure on command resposes which
have CRC atteched to it, which can be potentially dangerous. Even
more grueling problem happens when the command response is followed
by data transfer though, as in that case, the dwmci_data_transfer()
function will spin until it reaches the 240s timeout.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
6 years agocommon: build ymodem only on need
Jun Nie [Tue, 13 Feb 2018 08:07:55 +0000 (16:07 +0800)]
common: build ymodem only on need

Build ymodem only on need to shrink spl image size.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
6 years agocommon: Compile error with CONFIG_MULTI_DTB_FIT and not SPL
Lars Povlsen [Tue, 23 Oct 2018 08:21:25 +0000 (10:21 +0200)]
common: Compile error with CONFIG_MULTI_DTB_FIT and not SPL

common/common_fit.c is including <spl.h>, but not actually using it. The
inclusion will cuase compile error on platforms using CONFIG_OF_SEPARATE
and not SPL.

Signed-off-by: Lars Povlsen <lars.povlsen@microsemi.com>
Reviewed-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
6 years agodm: Fix typo - missed semicolon
Andy Shevchenko [Mon, 5 Nov 2018 16:24:03 +0000 (18:24 +0200)]
dm: Fix typo - missed semicolon

The commit

  484fdf5ba058 ("dm: Add support for all targets which requires MANUAL_RELOC")

introduces subtle typo, i.e. missed semicolon.

Fixes: 484fdf5ba058 ("dm: Add support for all targets which requires MANUAL_RELOC")
Cc: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
6 years agospl: fix debug prints for tiny printf
Simon Goldschmidt [Fri, 2 Nov 2018 20:49:52 +0000 (21:49 +0100)]
spl: fix debug prints for tiny printf

Tiny printf does not support %.*s and %lX. Since tiny printf should
be very common in SPL, replace these by %32s (for printing image
name) and %lx.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoMAINTAINERS: Update stm32mp entry
Patrick Delaunay [Thu, 8 Nov 2018 16:52:21 +0000 (17:52 +0100)]
MAINTAINERS: Update stm32mp entry

Add mailing list for stm32mp architecture and board.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agofit: Add missing CR in debug output in fit_find_config_node()
Stefan Roese [Thu, 8 Nov 2018 06:00:31 +0000 (07:00 +0100)]
fit: Add missing CR in debug output in fit_find_config_node()

Testing has shown that a line-break is missing in one debug line in
fit_find_config_node().

Signed-off-by: Stefan Roese <sr@denx.de>