project/bcm63xx/u-boot.git
6 years agoARM: omap3_logic: Make CONFIG_SYS_TEXT_BASE match README.omap3
Adam Ford [Sun, 21 Oct 2018 18:58:39 +0000 (13:58 -0500)]
ARM: omap3_logic: Make CONFIG_SYS_TEXT_BASE match README.omap3

README.omap3 has two options.  For option 1, CONFIG_SYS_TEXT_BASE
is set to 0x80100000.  Option 2 lists 0x80008000.  The existing
value is neither of these, so this patch makes it equivalent to
Option 1.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoARM: am3517_evm: Build for Thumb
Adam Ford [Sun, 21 Oct 2018 15:50:59 +0000 (10:50 -0500)]
ARM: am3517_evm: Build for Thumb

In an effort to free up more resources in SPL and U-Boot, building
for Thumb shrinks the code side.

Before:

  text    data     bss     dec     hex filename
  685588  25808  275724  987120   f0ff0 u-boot

  text    data     bss     dec     hex filename
  55324     417   67460  123201   1e141 spl/u-boot-spl

After:

   text    data     bss     dec     hex filename
 515502   25808  275708  817018   c777a u-boot

   text    data     bss     dec     hex filename
  42910     417   67460  110787   1b0c3 spl/u-boot-spl

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoconfigs: am3517_evm: Use default OMAP3 memory settings
Adam Ford [Sun, 21 Oct 2018 15:34:49 +0000 (10:34 -0500)]
configs: am3517_evm: Use default OMAP3 memory settings

The AM3517 is mostly am omap3, so this partch removes the custom
memory configurations and just uses the default common entries
for omap3 and armv7.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoARM: DTS: Resync am3517-evm.dts with Linux 4.19
Adam Ford [Sun, 21 Oct 2018 14:09:01 +0000 (09:09 -0500)]
ARM: DTS: Resync am3517-evm.dts with Linux 4.19

Some minor changes have been made to the AM3517-evm and the underlying
am3517.dtsi files.  This patch re-sync's the DTS and DTSI files with
Linux.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agomtd: nand: lpc32xx slc: disable DMA support in SPL builds
Vladimir Zapolskiy [Fri, 19 Oct 2018 00:21:18 +0000 (03:21 +0300)]
mtd: nand: lpc32xx slc: disable DMA support in SPL builds

Testing and analysis shows that at the moment LPC32xx NAND SLC driver
can not get PL080 DMA backbone support in SPL build, because SPL NAND
loaders operate with subpage (ECC step to be precisely) reads, and
this is not supported in the NAND SLC + DMA + hardware ECC calculation
bundle.

The change removes a cautious build time warning and explicitly
disables DMA flavour of the driver for SPL builds, to reduce the
amound of #ifdef sections the code blocks are minimally reorganized.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
6 years agomtd: nand: lpc32xx mlc: predefine number of NAND chips to support
Vladimir Zapolskiy [Fri, 19 Oct 2018 00:21:05 +0000 (03:21 +0300)]
mtd: nand: lpc32xx mlc: predefine number of NAND chips to support

Build option CONFIG_SYS_MAX_NAND_CHIPS is used by NXP LPC32xx NAND MLC
driver only, as a preparation for potential removal or replacement of
the option the change predefines CONFIG_SYS_MAX_NAND_CHIPS to 1, same
value is used by the single user Work Microwave Work 92105 board, thus
it will be safe now to remove the option as a board specific one.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
6 years agogpio: pca953x: Clear the polarity invert register at init
Ye Li [Thu, 18 Oct 2018 14:16:46 +0000 (16:16 +0200)]
gpio: pca953x: Clear the polarity invert register at init

The pca953x_gpio driver uses default value of polarity inversion
register. For some devices like PCA9557 and MAX7310, their polarity
inversion register default value is 0xf0. So for high 4 ports, when
reading their values, the values are inverted as the actual level.

This patch clears the polarity inversion register to 0 at init, so
that the port read and write values are aligned.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
6 years agoclk: Allow clock defaults to be set also during re-reloc state
Andreas Dannenberg [Wed, 17 Oct 2018 08:13:14 +0000 (13:43 +0530)]
clk: Allow clock defaults to be set also during re-reloc state

The earlier commit f4fcba5c5ba ("clk: implement clk_set_defaults()")
which introduced the functionality for setting clock defaults such as
rates and parents will skip the processing when executing in a re-reloc
state. This for example can prevent the assigning of clock parents
when running in SPL code. Go ahead and remove this limitation.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agobcm968580xref: add initial support
Philippe Reynes [Thu, 11 Oct 2018 16:31:59 +0000 (18:31 +0200)]
bcm968580xref: add initial support

This add the initial support of the broadcom reference
board bcm968580xref with a bcm6858 SoC.

This board has 512 MB of ram, 256 MB of flash (nand),
2 usb port, 1 uart, 4 ethernet ports (LAN), 1 ethernet port (WAN).

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
6 years agobcm6858: add initial support
Philippe Reynes [Thu, 11 Oct 2018 16:31:58 +0000 (18:31 +0200)]
bcm6858: add initial support

This add the initial support of the broadcom bcm6858 SoC family,
only the cpu, dram and uart are supported.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
6 years agoserial: bcm6858: add serial support
Philippe Reynes [Thu, 11 Oct 2018 16:31:57 +0000 (18:31 +0200)]
serial: bcm6858: add serial support

This driver add the support of serial on bcm6858.
It's based on serial for bcm6345.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
6 years agocmd/bdinfo: correct output of numerical values
Heinrich Schuchardt [Thu, 11 Oct 2018 11:15:01 +0000 (13:15 +0200)]
cmd/bdinfo: correct output of numerical values

Display all digits on 64bit systems. Currently we print only the lower
32 bits. Examples of values that can exceed 32 bits are the size and start of
memory banks.

For fdt_blob use the same output method as for other values. This avoids
misalignment.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agoarm: at91: wdt: Convert watchdog driver to dm/dt
Prasanthi Chellakumar [Tue, 9 Oct 2018 18:46:40 +0000 (11:46 -0700)]
arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>
6 years agoARMv8: SError exception handling in PSCI exception vectors
Chee Hong Ang [Mon, 20 Aug 2018 17:57:36 +0000 (10:57 -0700)]
ARMv8: SError exception handling in PSCI exception vectors

Allow platform vendors to handle SError interrupt exceptions from
ARMv8 PSCI exception vectors by overriding this weak function
'plat_error_handler'.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
6 years agoARMv8: Add EL3 exception handling for ARMv8's Kconfig
Chee Hong Ang [Mon, 20 Aug 2018 17:57:35 +0000 (10:57 -0700)]
ARMv8: Add EL3 exception handling for ARMv8's Kconfig

Kconfig option to allow all External Abort and SError exception
taken to EL3.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
6 years agoARMv8: Enable all asynchronous abort exceptions taken to EL3
Chee Hong Ang [Mon, 20 Aug 2018 17:57:34 +0000 (10:57 -0700)]
ARMv8: Enable all asynchronous abort exceptions taken to EL3

Allow EL3 to handle all the External Abort and SError interrupt
exception occur in all exception levels.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
6 years agoconfigs: Enable THUMB2 on various ARM boards
Tom Rini [Fri, 16 Nov 2018 18:32:59 +0000 (13:32 -0500)]
configs: Enable THUMB2 on various ARM boards

The clearfog, corvus, wb45n and picosam9g45 configs are close to
exceeding their size limits, so enable THUMB2 builds on them to reclaim
space.

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoMerge tag 'pull-14nov18' of git://git.denx.de/u-boot-dm
Tom Rini [Fri, 16 Nov 2018 13:37:50 +0000 (08:37 -0500)]
Merge tag 'pull-14nov18' of git://git.denx.de/u-boot-dm

- virtio implementation and supporting patches
- DM_FLAG_PRE_RELOC fixes
- regmap improvements
- minor buildman and sandbox things

6 years agotravis: Ensure we use pytest 2.8.7
Tom Rini [Thu, 15 Nov 2018 12:25:00 +0000 (07:25 -0500)]
travis: Ensure we use pytest 2.8.7

The latest version of pytest (4.0.0) makes some of the code we have in
test/py/conftest.py a fatal error that needs to be migrated.
Unfortunately this in turn requires changes that don't exist in older
versions of pytest such as 2.8.7 that ships with Ubuntu 16.04.  Force
travis to use this older version of pytest.

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-sunxi
Tom Rini [Wed, 14 Nov 2018 23:25:34 +0000 (18:25 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-sunxi

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
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>