platform/kernel/u-boot.git
2 years agoarm: a37xx: pci: Fix condition for CRS response
Pali Rohár [Tue, 19 Oct 2021 09:05:01 +0000 (11:05 +0200)]
arm: a37xx: pci: Fix condition for CRS response

As stated in comment above the code, CRS response can be returned to OS
only for 4-byte PCI_VENDOR_ID config read request. So fix the code.

Fixes: 1d7ad68559e2 ("arm: a37xx: pci: Handle propagation of CRSSVE bit from PCIe Root Port")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: Add missing "if SPL"
Tom Rini [Fri, 15 Oct 2021 14:54:41 +0000 (10:54 -0400)]
arm: mvebu: Add missing "if SPL"

We can only select SPL_SKIP_LOWLEVEL_INIT if SPL is enabled, otherwise
we get a warning about unmet dependencies on platforms that don't use
SPL.

Fixes: cf47a8cf8f7e ("arm: mvebu: Select SPL_SKIP_LOWLEVEL_INIT on ARMADA_32BIT")
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Do not allow setting bars on PCI Bridge
Pali Rohár [Tue, 12 Oct 2021 11:19:19 +0000 (13:19 +0200)]
arm: a37xx: pci: Do not allow setting bars on PCI Bridge

PCI Bridge which represents Aardvark PCIe Root Port does not have
configurable bars.

So ensure that write operation to bars registers on PCI Bridge is noop and
bars registers always contain zero address which indicates that bars are
unsupported.

After this change U-Boot 'pci bar 0.0.0' command does not show any
allocated bars for PCI Bridge device.

Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: cb056005dc67 ("arm: a37xx: pci: Add support for accessing PCI Bridge on root bus")
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: Move CONFIG_SPL_DRIVERS_MISC to Kconfig
Marek Behún [Sat, 9 Oct 2021 17:33:46 +0000 (19:33 +0200)]
arm: mvebu: turris_omnia: Move CONFIG_SPL_DRIVERS_MISC to Kconfig

Instead of declaring CONFIG_SPL_DRIVERS_MISC in board config header,
select it in Kconfig.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: Move SPL's SYS_MALLOC_SIMPLE to Kconfig
Marek Behún [Sat, 9 Oct 2021 17:33:45 +0000 (19:33 +0200)]
arm: mvebu: turris_omnia: Move SPL's SYS_MALLOC_SIMPLE to Kconfig

Instead of declaring CONFIG_SYS_MALLOC_SIMPLE dependant on
CONFIG_SPL_BUILD in board config header, select
CONFIG_SPL_SYS_MALLOC_SIMPLE in Kconfig.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: Use show_board_info()
Marek Behún [Sat, 9 Oct 2021 17:33:44 +0000 (19:33 +0200)]
arm: mvebu: turris_omnia: Use show_board_info()

We are printing board information in checkboard() function, which is
called from the default weak implementation of show_board_info().

Rename checkboard() to show_board_info(). This throws away the weak
implementation of show_board_info().

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: Overwrite ethaddr only if invalid
Marek Behún [Sat, 9 Oct 2021 17:33:43 +0000 (19:33 +0200)]
arm: mvebu: turris_omnia: Overwrite ethaddr only if invalid

Currently we always overwrite ethaddrs with those from EEPROM.

In order to allow user to use a cloned MAC address in U-Boot, change the
code so that it sets ethaddr variables only if they aren't set or are
invalid.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_mox: Better check for valid ethernet addresses in env
Marek Behún [Sat, 9 Oct 2021 17:33:42 +0000 (19:33 +0200)]
arm: mvebu: turris_mox: Better check for valid ethernet addresses in env

Currently we overwrite ethaddr and eth1addr only if these variables
don't exist.

Better overwrite them even if the env variable exists, but is invalid -
eth_env_get_enetaddr_by_index() checks for validity.

Refactor the code to use a for cycle.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_mox: Always handle reset button
Marek Behún [Sat, 9 Oct 2021 17:33:41 +0000 (19:33 +0200)]
arm: mvebu: turris_mox: Always handle reset button

Handle reset button even if we can't configure modules.

This happens if we fail retrieving reset GPIO with which we can reset
the modules.

(Note that this GPIO is different from reset button GPIO.)

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_mox: Use show_board_info()
Marek Behún [Sat, 9 Oct 2021 17:33:40 +0000 (19:33 +0200)]
arm: mvebu: turris_mox: Use show_board_info()

We are printing board information in last_stage_init(), but U-Boot has
dedicated function, show_board_info(), for this.

Move code which prints board information (board version, serial number,
module topology, ...) to show_board_info().

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_mox: Cosmetic update for board config header
Marek Behún [Sat, 9 Oct 2021 17:33:39 +0000 (19:33 +0200)]
arm: mvebu: turris_mox: Cosmetic update for board config header

Reorder the definitions in Turris MOX' board config header, drop the
comment relics from when this file was copied, fix indentation.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: kirkwood, mvebu: Remove CONFIG_SYS_RESET_ADDRESS option
Marek Behún [Sat, 9 Oct 2021 17:33:38 +0000 (19:33 +0200)]
arm: kirkwood, mvebu: Remove CONFIG_SYS_RESET_ADDRESS option

This option is not used anywhere.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a3720: Create Kconfig option for I2C_MV
Marek Behún [Sat, 9 Oct 2021 17:33:37 +0000 (19:33 +0200)]
arm: mvebu: a3720: Create Kconfig option for I2C_MV

Move the config option CONFIG_I2C_MV to a Kconfig option
CONFIG_SYS_I2C_MV and move the default definition from config header
files into defconfigs.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_mox: Move options to defconfig
Marek Behún [Sat, 9 Oct 2021 17:33:36 +0000 (19:33 +0200)]
arm: mvebu: turris_mox: Move options to defconfig

Move config options CONFIG_LAST_STAGE_INIT and
CONFIG_DISPLAY_BOARDINFO_LATE to turris_mox_defconfig.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: termios_linux.h: Fix tcsendbreak() implementation
Pali Rohár [Wed, 6 Oct 2021 12:30:25 +0000 (14:30 +0200)]
tools: termios_linux.h: Fix tcsendbreak() implementation

There are two Linux ioctls which implements tcsendbreak() functionality:
TCSBRK and TCSBRKP

TCSBRK with non-zero parameter implements tcdrain() and with zero parameter
implements tcsendbreak() for duration of 0.25s.

TCSBRKP with zero parameter is same as TCSBRK and with non-zero parameter
implements tcsendbreak() for duration in deciseconds specified by
parameter. TCSBRKP does not have to be provided by older toolchain
versions.

So tcsendbreak() has to either use TCSBRK with zero parameter or TCSBRKP
with any parameter.

Fix code to use TCSBRKP and fallback to TCSBRK with 0.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agocmd: tlv_eeprom
Sven Auhagen [Sun, 12 Sep 2021 07:25:44 +0000 (09:25 +0200)]
cmd: tlv_eeprom

The function show_eeprom is missing int i if debug is enabled.

Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoMerge branch '2021-10-19-assorted-changes'
Tom Rini [Wed, 20 Oct 2021 00:45:12 +0000 (20:45 -0400)]
Merge branch '2021-10-19-assorted-changes'

- Assorted minor fixes and a new GPIO driver

2 years agoclk: fixed_rate: add dummy disable() function
Samuel Holland [Wed, 13 Oct 2021 00:40:29 +0000 (19:40 -0500)]
clk: fixed_rate: add dummy disable() function

commit 6bf6d81c1112 ("clk: fixed_rate: add dummy enable() function")
implemented .enable, so fixed rate clocks can be used where drivers
might call clk_enable(). Implement the .disable op for the same reason;
some drivers, e.g. USB PHYs, may attempt to disable clocks at runtime.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2 years agoarm: total_compute: increase DRAM to 8GB
Usama Arif [Tue, 12 Oct 2021 12:43:16 +0000 (13:43 +0100)]
arm: total_compute: increase DRAM to 8GB

The extra 6GB start at 0x8080000000.

Signed-off-by: Usama Arif <usama.arif@arm.com>
2 years agotools: Stop re-defining -std= when building tools
Tom Rini [Mon, 11 Oct 2021 15:11:41 +0000 (11:11 -0400)]
tools: Stop re-defining -std= when building tools

While we intentionally set -std=gnu11 for building host tools, and have
for quite some time, we never dropped -std=gnu99 from tools/Makefile.
This resulted in passing -std=gnu11 ... -std=gnu99 when building, and
gnu99 would win.  This in turn would result now in warnings such as:
tools/mkeficapsule.c:25:15: warning: redefinition of typedef 'u32' is a C11 feature [-Wtypedef-redefinition]
typedef __u32 u32;
              ^

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoconfigs: am335x_evm: enable CONFIG_CLK_TI_CTRL
Amjad Ouled-Ameur [Mon, 11 Oct 2021 12:27:38 +0000 (14:27 +0200)]
configs: am335x_evm: enable CONFIG_CLK_TI_CTRL

This enables the clock controller driver support on TI's SoCs. This will
fix this GPIO issue at boot time:
request_and_set_gpio: Unable to request GPIO_PR1_MII_CTRL
request_and_set_gpio: Unable to request GPIO_MUX_MII_CTRL
request_and_set_gpio: Unable to request GPIO_FET_SWITCH_CTRL
request_and_set_gpio: Unable to request GPIO_PHY_RESET

This issue comes from the fact that the clock controller is not probed.

Enable the TI's clock controller driver support to solve this.

Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
2 years agodrivers/gpio: add support for MAX7320 i2c i/o expander
Hannes Schmelzer [Fri, 1 Oct 2021 11:37:57 +0000 (13:37 +0200)]
drivers/gpio: add support for MAX7320 i2c i/o expander

This commit adds support for the MAX7320 (and clones) gpio expander.

Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
2 years agoMakefile: Only build dtc if needed
Simon Glass [Wed, 22 Sep 2021 17:34:44 +0000 (11:34 -0600)]
Makefile: Only build dtc if needed

At present U-Boot always builds dtc if CONFIG_OF_CONTROL is defined, even
when DTC is provided. The built dtc is not actually used, so this is a
waste of time.

Update the Makefile logic to build dtc only if one is not provided to the
build with the DTC variable. Add documentation to explain this.

This saves about 3.5 seconds of elapsed time on a clean build of
sandbox_spl for me.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoRevert "kbuild: remove unused dtc-version.sh script"
Simon Glass [Wed, 22 Sep 2021 17:34:43 +0000 (11:34 -0600)]
Revert "kbuild: remove unused dtc-version.sh script"

We need this to make building dtc optional. It makes no sense to build our
own dtc if the system one works correctly.

This reverts commit ddb87a0b40262ff99d675e946f57427642303938.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch '2021-10-18-OF_xxx-cleanup'
Tom Rini [Tue, 19 Oct 2021 13:07:07 +0000 (09:07 -0400)]
Merge branch '2021-10-18-OF_xxx-cleanup'

- Clean things up and rework such that we can drop OF_PRIOR_STAGE

2 years agotreewide: Remove OF_PRIOR_STAGE
Ilias Apalodimas [Mon, 11 Oct 2021 21:00:15 +0000 (00:00 +0300)]
treewide: Remove OF_PRIOR_STAGE

The previous patches removed OF_PRIOR_STAGE from the last consumers of the
Kconfig option.  Cleanup any references to it in documentation,  code and
configuration options.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoboard: arm: Remove OF_PRIOR_STAGE from the remaining Arm boards
Ilias Apalodimas [Mon, 11 Oct 2021 21:00:14 +0000 (00:00 +0300)]
board: arm: Remove OF_PRIOR_STAGE from the remaining Arm boards

At some point back in 2018 prior_stage_fdt_address and OF_PRIOR_STAGE got
introduced,  in order to support a DTB handed over by an earlier stage boo
loader.  However we have another option in the Kconfig (OF_BOARD) which has
identical semantics.

So let's remove the option in an effort to simplify U-Boot's config and DTB
management,  and use OF_BOARD instead.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoriscv: Remove OF_PRIOR_STAGE from RISC-V boards
Ilias Apalodimas [Mon, 11 Oct 2021 21:00:13 +0000 (00:00 +0300)]
riscv: Remove OF_PRIOR_STAGE from RISC-V boards

At some point back in 2018 prior_stage_fdt_address and OF_PRIOR_STAGE got
introduced,  in order to support a DTB handed over by an earlier stage boo
loader.  However we have another option in the Kconfig (OF_BOARD) which has
identical semantics.

On RISC-V some of the boards pick up the DTB from a1 and copy it in their
private gd_t.  Apart from that they copy it to prior_stage_fdt_address,  if
the Kconfig option is selected, which is unnecessary.

So let's switch the config option for those boards to OF_BOARD and define
the required board_fdt_blob_setup() for them.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2 years agoMerge tag 'u-boot-rockchip-20211015' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 18 Oct 2021 01:13:49 +0000 (21:13 -0400)]
Merge tag 'u-boot-rockchip-20211015' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

- Fix for Rockchip mmc HS400 mode;
- Fix for px30 board Odroid Go;
- rockchip_sfc update;
- rk3568 clk update;
- doc fix;

2 years agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-tegra
Tom Rini [Fri, 15 Oct 2021 19:58:16 +0000 (15:58 -0400)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-tegra

On merge, fixup order of fdtdec_add_reserved_memory parameters in
arch/arm/cpu/armv8/fsl-layerscape/soc.c

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge branch '2021-10-15-Kconfig-migrations'
Tom Rini [Fri, 15 Oct 2021 17:45:15 +0000 (13:45 -0400)]
Merge branch '2021-10-15-Kconfig-migrations'

- Assorted Kconfig migration patches

2 years agoconfigs: Resync with savedefconfig
Tom Rini [Fri, 15 Oct 2021 12:06:20 +0000 (08:06 -0400)]
configs: Resync with savedefconfig

Resync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoConvert CONFIG_USB_EHCI_IS_TDI to Kconfig
Marek Behún [Sat, 9 Oct 2021 13:27:35 +0000 (15:27 +0200)]
Convert CONFIG_USB_EHCI_IS_TDI to Kconfig

On mvebu this is defined if and only if !ARM64.

Otherwise it is defined for boards with ARCH_MX23, ARCH_TEGRA and
ARCH_ZYNQ, and also for SOC_AR934X (tplink_wdr4300).

Signed-off-by: Marek Behún <marek.behun@nic.cz>
2 years agoDrop CONFIG_USB_EHCI_KIRKWOOD
Marek Behún [Sat, 9 Oct 2021 13:27:34 +0000 (15:27 +0200)]
Drop CONFIG_USB_EHCI_KIRKWOOD

This config option doesn't do anything.

nas220 uses USB_EHCI_MARVELL.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
2 years agoConvert CONFIG_USB_EHCI_MXS to Kconfig
Marek Behún [Sat, 9 Oct 2021 13:27:33 +0000 (15:27 +0200)]
Convert CONFIG_USB_EHCI_MXS to Kconfig

This option is only used for
  mx23evk_defconfig
  mx23_olinuxino_defconfig
which are the only i.MX23 boards.

Add depend on ARCH_MX23 and default to y.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
2 years agoRename CONFIG_EHCI_IS_TDI to CONFIG_USB_EHCI_IS_TDI
Marek Behún [Sat, 9 Oct 2021 13:27:32 +0000 (15:27 +0200)]
Rename CONFIG_EHCI_IS_TDI to CONFIG_USB_EHCI_IS_TDI

In preparation for moving this option to Kconfig, rename it to be
consistent with other USB EHCI Kconfig options.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
2 years agommc: rockchip_sdhci: enable strobe line for HS400
Yifeng Zhao [Fri, 15 Oct 2021 08:41:27 +0000 (16:41 +0800)]
mmc: rockchip_sdhci: enable strobe line for HS400

The default configuration of rk3399 EMMC PHY does not enable the
strobe line, and EMMC controller will got data transmission error
at HS400 mode.

Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoclk: rockchip: rk3568: update clks
Elaine Zhang [Tue, 12 Oct 2021 08:43:00 +0000 (16:43 +0800)]
clk: rockchip: rk3568: update clks

fix up ppll init freq.
support tclk_emmc.
add freq (26M) for mmc device.
fix up the sfc clk rate unit error.

Change in V2:
remove change id.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agospi: rockchip_sfc: Using read_poll
Jon Lin [Fri, 17 Sep 2021 13:14:59 +0000 (21:14 +0800)]
spi: rockchip_sfc: Using read_poll

Using read_poll logic.

Tested-by: Chris Morgan <macromorgan@hotmail.com>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agospi: rockchip_sfc: Implement set_speed logic
Jon Lin [Fri, 17 Sep 2021 13:14:58 +0000 (21:14 +0800)]
spi: rockchip_sfc: Implement set_speed logic

Set clock related processing into set_speed logic. And Optimize
printing format.

Tested-by: Chris Morgan <macromorgan@hotmail.com>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: px30: sync serial flash controller bindings with mainline
Chris Morgan [Sat, 21 Aug 2021 01:46:58 +0000 (20:46 -0500)]
rockchip: px30: sync serial flash controller bindings with mainline

The devicetree submitted and approved for the mainline linux kernel is
slightly different than the one present here. This syncs both
devicetrees (for the Rockchip SFC node at least) present on the PX30
and the Odroid Go Advance. Changes include renaming the flash node,
reordering the values in the SFC node for the rk3326-odroid-go2,
changing the name of the cs pinctrl node to cs0, and updating the
u-boot specific tree to utilize the new flash node value.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agodoc: rockchip: write all brand names with a capital
Johan Jonker [Fri, 20 Aug 2021 17:27:59 +0000 (19:27 +0200)]
doc: rockchip: write all brand names with a capital

Brand names are supposed to be written with a capital,
so change them all.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agodoc: rockchip: sort rockchip support list for rk3188
Johan Jonker [Fri, 20 Aug 2021 17:27:58 +0000 (19:27 +0200)]
doc: rockchip: sort rockchip support list for rk3188

In the list of mainline U-boot supported Rockchip boards
rk3188 is placed below under the name rv3188. Give back it's
original name and sort the list in alphabetical order.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk33xx: Drop ROCKCHIP_USB2_PHY on boards without it
Peter Robinson [Thu, 12 Aug 2021 09:11:32 +0000 (10:11 +0100)]
rockchip: rk33xx: Drop ROCKCHIP_USB2_PHY on boards without it

The 64 bit rk33xx chips don't have the ROCKCHIP_USB2_PHY IP so
drop the configs as they were likely copied over from other
boards during enablement.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: board: remove SCLK_GPU from U-Boot DT
Chris Morgan [Thu, 5 Aug 2021 16:48:48 +0000 (11:48 -0500)]
rockchip: board: remove SCLK_GPU from U-Boot DT

Starting with commit 92f1e9a4b31c ("clk: Detect failure to set
defaults") the clk driver for the PX30 would fail to probe for the
Odroid Go Advance. This patch is to remove the clock for the GPU from
the U-Boot specific devicetree, as that clock is not supported by the
U-Boot clk_px30 driver.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: px30: add support for setting cpll clock
Chris Morgan [Thu, 5 Aug 2021 16:48:47 +0000 (11:48 -0500)]
rockchip: px30: add support for setting cpll clock

Starting with commit 92f1e9a4b31c ("clk: Detect failure to set
defaults") the clk driver for the PX30 for the Odroid Go Advance would
no longer probe correctly, because setting the cpll and gpu clocks are
not supported with the clk_px30 U-Boot driver. This adds support for
setting the cpll clock to the clk_px30 driver. Another patch will
update the U-Boot specific device-tree to remove the GPU clock which is
not used by U-Boot.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoRemove unused CONFIG_CONS_NONE
Patrick Delaunay [Mon, 4 Oct 2021 09:59:54 +0000 (11:59 +0200)]
Remove unused CONFIG_CONS_NONE

Remove the latest reference of CONFIG_CONS_NONE in code

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoRemove unused CONFIG_SYS_FLASH_AMD_CHECK_DQ7
Patrick Delaunay [Mon, 4 Oct 2021 09:59:53 +0000 (11:59 +0200)]
Remove unused CONFIG_SYS_FLASH_AMD_CHECK_DQ7

Remove the latest reference of CONFIG_SYS_FLASH_AMD_CHECK_DQ7 in code

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoRemove unused CONFIG_NO_RELOCATION
Patrick Delaunay [Mon, 4 Oct 2021 09:59:52 +0000 (11:59 +0200)]
Remove unused CONFIG_NO_RELOCATION

Remove the latest reference of CONFIG_NO_RELOCATION in code

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoam33x: Remove unused define CONFIG_MUSB_HOST
Patrick Delaunay [Mon, 4 Oct 2021 09:59:51 +0000 (11:59 +0200)]
am33x: Remove unused define CONFIG_MUSB_HOST

This define was left over from a previous revision, and was never used.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoscripts: remove some configs in config_whitelist.txt
Patrick Delaunay [Mon, 4 Oct 2021 09:59:50 +0000 (11:59 +0200)]
scripts: remove some configs in config_whitelist.txt

Remove some config finishing by _ badly added by
scripts/build-whitelist.sh when joker is used in comments.

for example:
  doc/uImage.FIT/command_syntax_extensions.txt:
     ... #ifdef CONFIG_OF_*  | ...

  cmd/nvedit.c:# error Define one of CONFIG_ENV_IS_IN_{EEPROM| \
     FLASH|MMC|FAT|EXT4|\

Remove also configs only used in comments:
- CONFIG_BOOGER in include/linux/kconfig.h
- CONFIG_COMMANDS
- CONFIG_INIT_IGNORE_ERROR
- CONFIG_REG_*
- CONFIG_HOTPLUG : drivers/watchdog/omap_wdt.c:18

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch '2021-10-14-assorted-updates'
Tom Rini [Fri, 15 Oct 2021 11:50:59 +0000 (07:50 -0400)]
Merge branch '2021-10-14-assorted-updates'

- Update to LLVM-13 in CI, assorted PCI fixes and pytest in CI
  improvements

2 years agoboard/km: update MAINTAINERS files
Holger Brunck [Tue, 12 Oct 2021 06:50:38 +0000 (08:50 +0200)]
board/km: update MAINTAINERS files

Update the e-mail addresses and person responsible.

Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
CC: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitachienergy.com>
CC: Rainer Boschung <rainer.boschung@hitachienergy.com>
2 years agopytest: Show a message when sandbox crashes
Simon Glass [Fri, 8 Oct 2021 15:15:23 +0000 (09:15 -0600)]
pytest: Show a message when sandbox crashes

When a test hands on a real board there is no way on the console to obtain
any information about why it hung.

With sandbox we can actually find out that it died and get a signal or
exit code. Add this to make it easier to figure out what happened.

So instead of:

test/py/u_boot_spawn.py:171: in expect
    c = os.read(self.fd, 1024).decode(errors='replace')
E   OSError: [Errno 5] Input/output error

We get:

test/py/u_boot_spawn.py:171: in expect
    c = os.read(self.fd, 1024).decode(errors='replace')
E   ValueError: U-Boot exited with signal 11 (Signals.SIGSEGV)

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopci: Fix printf format for regions
Pali Rohár [Fri, 8 Oct 2021 15:01:24 +0000 (17:01 +0200)]
pci: Fix printf format for regions

Correct printf format for unsigned long long is %llx and not %llxx.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopci: Fix showing registers
Pali Rohár [Thu, 7 Oct 2021 12:51:01 +0000 (14:51 +0200)]
pci: Fix showing registers

Header type is 7-bit number so use all 7 bits when detecting header type
and not only 2 bits.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopci: Fix showing bars
Pali Rohár [Thu, 7 Oct 2021 12:51:00 +0000 (14:51 +0200)]
pci: Fix showing bars

Header type is 7-bit number so properly clear upper 8th bit which
indicates multifunction device.

And do not try to show bars for unsupported header types.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopci: Fix configuring BARs
Pali Rohár [Thu, 7 Oct 2021 12:50:59 +0000 (14:50 +0200)]
pci: Fix configuring BARs

Number of BARs is defined by header type, not by class code.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopci: Skip configuring invalid P2P bridge devices
Pali Rohár [Thu, 7 Oct 2021 12:50:58 +0000 (14:50 +0200)]
pci: Skip configuring invalid P2P bridge devices

Function dm_pci_hose_probe_bus() expects that bus is valid PCI device with
Bridge header type (0x01). So add check before touching PCI config space to
prevent misconfiguring some non-standard device.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopci: Skip configuring PCI Rom Address for unsupported header types
Pali Rohár [Thu, 7 Oct 2021 12:50:57 +0000 (14:50 +0200)]
pci: Skip configuring PCI Rom Address for unsupported header types

PCI Rom Address is currently supported only for Normal (0x00) and
Bridge (0x01) header types. Fix code accordingly.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopytest: Shorten traceback length by default
Simon Glass [Wed, 6 Oct 2021 02:18:00 +0000 (20:18 -0600)]
pytest: Shorten traceback length by default

This produces a lot of code output which is not very helpful and is quite
annoying to wade through. Use the short format by default.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoCI: Update to LLVM-13
Tom Rini [Tue, 5 Oct 2021 17:51:38 +0000 (13:51 -0400)]
CI: Update to LLVM-13

- Switch sources and CI scripts to install and use LLVM-13
- Update to latest "focal" tag.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoARM: tegra: Copy memory-region-names property
Thierry Reding [Fri, 3 Sep 2021 13:16:25 +0000 (15:16 +0200)]
ARM: tegra: Copy memory-region-names property

If multiple entries are present in the memory-region property, this new
memory-region-names property can be used to specify names for each of
them so that they can be more easily distinguished.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2 years agoARM: tegra: Refactor DT update helpers
Thierry Reding [Fri, 3 Sep 2021 13:16:24 +0000 (15:16 +0200)]
ARM: tegra: Refactor DT update helpers

Rather than duplicate the Ethernet MAC address and carveout updating
code for each board, move it to a common location and make it more
reusable.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2 years agoARM: tegra: Support EMC frequency tables on Tegra210
Thierry Reding [Wed, 13 Oct 2021 20:06:02 +0000 (13:06 -0700)]
ARM: tegra: Support EMC frequency tables on Tegra210

The EMC frequency tables are created from a training sequence performed
during early boot and passed in via a reserved memory region by nvtboot.
Copy this table to the kernel DTB so that the kernel can use it to scale
the EMC frequency at runtime.

Note that early bootloaders store the EMC table at an address that
currently intersects with the load address of the initial ramdisk. In
order to avoid copying the table to a different address, simply change
the load address for the initial ramdisk in U-Boot.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2 years agoARM: tegra: Support multiple reserved memory regions
Thierry Reding [Fri, 3 Sep 2021 13:16:22 +0000 (15:16 +0200)]
ARM: tegra: Support multiple reserved memory regions

Support multiple reserved memory regions per device to support platforms
that use both a framebuffer and color conversion lookup table for early
boot display splash.

While at it, also pass along the name, compatible strings and flags of
the carveouts.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2 years agofdtdec: Support reserved-memory flags
Thierry Reding [Fri, 3 Sep 2021 13:16:21 +0000 (15:16 +0200)]
fdtdec: Support reserved-memory flags

Reserved memory nodes can have additional flags. Support reading and
writing these flags to ensure that reserved memory nodes can be properly
parsed and emitted.

This converts support for the existing "no-map" flag to avoid extending
the argument list for fdtdec_add_reserved_memory() to excessive length.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2 years agofdtdec: Reorder fdtdec_set_carveout() parameters for consistency
Thierry Reding [Fri, 3 Sep 2021 13:16:20 +0000 (15:16 +0200)]
fdtdec: Reorder fdtdec_set_carveout() parameters for consistency

The fdtdec_set_carveout() function's parameters are inconsistent with
the parameters passed to fdtdec_add_reserved_memory(). Fix up the order
to make it more consistent.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2 years agofdtdec: Support compatible string list for reserved memory
Thierry Reding [Fri, 3 Sep 2021 13:16:19 +0000 (15:16 +0200)]
fdtdec: Support compatible string list for reserved memory

Reserved memory nodes can have a compatible string list to identify the
type of reserved memory that they represent. Support specifying an
optional compatible string list when creating these nodes.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2 years agofdtdec: Support retrieving the name of a carveout
Thierry Reding [Fri, 3 Sep 2021 13:16:18 +0000 (15:16 +0200)]
fdtdec: Support retrieving the name of a carveout

When retrieving a given carveout for a device, allow callers to query
the name. This helps differentiating between carveouts when there are
more than one.

This is also useful when copying carveouts to help assign a meaningful
name that cannot always be guessed.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2 years agofdtdec: Allow using fdtdec_get_carveout() in loops
Thierry Reding [Fri, 3 Sep 2021 13:16:17 +0000 (15:16 +0200)]
fdtdec: Allow using fdtdec_get_carveout() in loops

In order make it possible to use fdtdec_get_carveout() in loops, return
FDT_ERR_NOTFOUND when the passed-in index exceeds the number of phandles
present in the given property.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2 years agoMerge branch '2021-10-12-assorted-fixes-and-updates'
Tom Rini [Wed, 13 Oct 2021 14:14:35 +0000 (10:14 -0400)]
Merge branch '2021-10-12-assorted-fixes-and-updates'

- Add Macronix raw NAND controller, fastboot, spelling and nvme fixes,
  ds1307 fix for oscillator-stop bit and fatfs optimization.

2 years agonvme: invalidate correct memory range after read
Stefan Agner [Mon, 4 Oct 2021 09:24:51 +0000 (11:24 +0200)]
nvme: invalidate correct memory range after read

The current code invalidates the range after the read buffer since the
buffer pointer gets incremented in the read loop. Use a temporary
pointer to make sure we have a pristine pointer to invalidate the
correct memory range after read.

Fixes: 704e040a51d2 ("nvme: Apply cache operations on the DMA buffers")
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
2 years agotools/image-host.c: Fix spelling of "expected".
Vagrant Cascadian [Tue, 28 Sep 2021 17:11:46 +0000 (10:11 -0700)]
tools/image-host.c: Fix spelling of "expected".

Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agortc: ds1307: Handle oscillator-stop bit correctly
Mark Tomlinson [Mon, 27 Sep 2021 21:10:42 +0000 (10:10 +1300)]
rtc: ds1307: Handle oscillator-stop bit correctly

The DS1307 driver was originally based on the DS1337 driver. However,
the functionality of the clock set/get functions has diverged. In the
original DS1337 driver, the set/get functions did the following:
  1) Setting the clock ensured the oscillator was enabled.
  2) Getting the clock checked and reset the oscillator-stop flag.
The DS1307 does not have an oscillator-stop flag, but the driver tried
(incorrectly) to emulate this by ensuring the oscillator was running. It
really makes no sense to start a stopped clock without setting it.

This patch makes the DS1307 driver behave like the original DS1337
driver again. For the DS1307 itself, this is just a removal of code,
since there is no oscillator-fail bit to check or reset, and the clock
is started when it is set. Since the DS1307 driver can now also be used
for the DS1337 and DS1340 which do have this bit, add code to handle the
oscillator-stop bit in the same was the original DS1337 driver did --
i.e. report that the oscillator had stopped and clear the flag.

This means that setting the date using the date command (which does both
a get and a set) will now clear the oscillator-stop flag in addition to
setting and starting the clock.

The old-style (non-DM) code has not been updated and will be removed in
a future patch. Note that this older code does not support the DS1337,
as there is a separate driver for this. Also note that the original (DM)
code used the wrong control-register address for the DS1337.

Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
2 years agofs: fat: check for buffer size before reading blocks
Ricardo Salveti [Sun, 26 Sep 2021 18:36:04 +0000 (21:36 +0300)]
fs: fat: check for buffer size before reading blocks

This patch optimizes the commit mentioned below by avoiding running
a set of commands which are useless in the case when
size < mydata->sect_size and sect_count would be 0.

Fixes: 5b3ddb17ba ("fs/fat/fat.c: Do not perform zero block reads if there are no blocks left")

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Co-developed-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
2 years agomtd: rawnand: Add Macronix raw NAND controller driver
Zhengxun Li [Tue, 14 Sep 2021 05:43:51 +0000 (13:43 +0800)]
mtd: rawnand: Add Macronix raw NAND controller driver

Add a driver for Macronix raw NAND controller.

This patch referred from linux mxic_nand.c. The difference from the
linux version is described here.

1. In order to adapt to the uboot nand framework, add function
   binding (cmdfunc, read_byte, read_buf, write_buf).

2. Added parsing command format to use hardware correctly.

3. Remove the incompatible functions of Uboot.

Signed-off-by: Zhengxun Li <zhengxunli@mxic.com.tw>
2 years agofastboot: fix partition name truncation in environment lookup
Matthias Schiffer [Fri, 30 Jul 2021 12:23:54 +0000 (14:23 +0200)]
fastboot: fix partition name truncation in environment lookup

strlcat() need to be passed the full buffer length. The incorrect call
caused truncation of partition names for fastboot_raw_partition_... and
fastboot_partition_alias_... env lookup to much less than PART_NAME_LEN.

Fixes: 69a752983171 ("fastboot: Fix possible buffer overrun")
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
2 years agoMerge tag 'u-boot-stm32-20211012' of https://source.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Tue, 12 Oct 2021 16:01:00 +0000 (12:01 -0400)]
Merge tag 'u-boot-stm32-20211012' of https://source.denx.de/u-boot/custodians/u-boot-stm

- Disable ATAGS for STM32 MCU and MPU boards
- Disable bi_boot_params for STM32 MCU and MPU boards
- Update stm32-usbphyc node management
- Convert CONFIG_STM32_FLASH to Kconfig for STM32 MCU boards
- Convert some USB config flags to Kconfig for various boards
- Convert CONFIG_BOOTCOMMAND flag to Kconfig for STM32 F429 board
- Remove specific CONFIG_STV0991 flags
- Remove unused CONFIG_USER_LOWLEVEL_INIT flag
- Add ofdata_to_platdata() callback for stm32_spi driver
- Update for stm32f7_i2c driver
- Remove gpio_hog_probe_all() from STM32 MP1 board
- Fix bind command

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge tag 'u-boot-at91-2022.01-b' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 12 Oct 2021 15:49:15 +0000 (11:49 -0400)]
Merge tag 'u-boot-at91-2022.01-b' of https://source.denx.de/u-boot/custodians/u-boot-at91

Second set of u-boot-at91 features for the 2022.01 cycle:

This small feature set adds the support for PWM driver for the sama5d2
SoC. It also adds a node in the DT for this SoC.

2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Tue, 12 Oct 2021 12:58:58 +0000 (08:58 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-sunxi

The bulk of it is Samuel's DM_I2C rework, which removes the nasty I2C
deprecation warnings for most 32-bit boards. It also includes some
smaller refactorings that pave the way for more changes, mostly driven
by needing to support the Allwinner RISC-V SoC later on.

Board wise we gain support for the FriendlyARM NanoPi R1S H5 router
board and official Pinetab support.

Build-tested for all 160 sunxi boards, and boot tested on a A64, A20,
H3, H6, and H616 board. USB, SD card, eMMC, and Ethernet all work there
(where applicable).

2 years agotest/py: Add usb gadget binding test
Patrice Chotard [Fri, 10 Sep 2021 14:16:24 +0000 (16:16 +0200)]
test/py: Add usb gadget binding test

Add a specific usb gadget binding test which check that
binding a driver without compatible string is working as expected.

the command "bind /usb@1 usb_ether" should give the following "dm tree"
command output:

[...]
 usb           0  [   ]   usb_sandbox           |-- usb@1
 usb_hub       0  [   ]   usb_hub               |   |-- hub
 usb_emul      0  [   ]   usb_sandbox_hub       |   |   `-- hub-emul
 usb_emul      1  [   ]   usb_sandbox_flash     |   |       |-- flash-stick@0
 usb_emul      2  [   ]   usb_sandbox_flash     |   |       |-- flash-stick@1
 usb_emul      3  [   ]   usb_sandbox_flash     |   |       |-- flash-stick@2
 usb_emul      4  [   ]   usb_sandbox_keyb      |   |       `-- keyb@3
 eth           4  [   ]   usb_ether             |   `-- usb@1
[...]

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoconfigs: sandbox: add USB_ETHER and GADGET_DOWNLOAD gadget support
Patrice Chotard [Fri, 10 Sep 2021 14:16:23 +0000 (16:16 +0200)]
configs: sandbox: add USB_ETHER and GADGET_DOWNLOAD gadget support

This is needed for new gadget binding test.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agousb: sandbox: Add gadget callbacks
Patrice Chotard [Fri, 10 Sep 2021 14:16:22 +0000 (16:16 +0200)]
usb: sandbox: Add gadget callbacks

Add usb_gadget_handle_interrupts(), usb_gadget_register_driver()
and usb_gadget_unregister_driver() to be able to test
binding usb gadget.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agousb: gadget: Add bcdDevice for the DWC2 USB Gadget Controller
Patrice Chotard [Fri, 10 Sep 2021 14:16:21 +0000 (16:16 +0200)]
usb: gadget: Add bcdDevice for the DWC2 USB Gadget Controller

Add an entry in usb_gadget_controller_number() for the DWC2
gadget controller. It is used to bind the USB Ethernet driver.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reported-by: Herbert Poetzl <herbert@13thfloor.at>
Cc: Marek Vasut <marex@denx.de>
Cc: Herbert Poetzl <herbert@13thfloor.at>
2 years agocmd: bind: Fix driver binding on a device
Patrice Chotard [Fri, 10 Sep 2021 14:16:20 +0000 (16:16 +0200)]
cmd: bind: Fix driver binding on a device

Fix a regression brings by commit 84f8e36f03fa ("cmd: bind: allow to
bind driver with driver data")

As example, the following bind command doesn't work:

   bind /soc/usb-otg@49000000 usb_ether

As usb_ether driver has no compatible string, it can't be find by
lists_bind_fdt(). In bind_by_node_path(), which called lists_bind_fdt(),
the driver entry is known, pass it to lists_bind_fdt() to force the driver
entry selection.

For this, add a new parameter struct *driver to lists_bind_fdt().
Fix also all lists_bind_fdt() callers.

Fixes: 84f8e36f03fa ("cmd: bind: allow to bind driver with driver data")
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reported-by: Herbert Poetzl <herbert@13thfloor.at>
Cc: Marek Vasut <marex@denx.de>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoARM: dts: sama5d2: Add pwm0 definition
Dan Sneddon [Mon, 20 Sep 2021 23:28:46 +0000 (16:28 -0700)]
ARM: dts: sama5d2: Add pwm0 definition

Add node for the PWM0 on the SAMA5D2 SoC.

Signed-off-by: Dan Sneddon <dan.sneddon@microchip.com>
2 years agodt-bindings: pwm: pwm-at91: Add PWM bindings for A5D2
Dan Sneddon [Mon, 20 Sep 2021 23:28:45 +0000 (16:28 -0700)]
dt-bindings: pwm: pwm-at91: Add PWM bindings for A5D2

Document the bindings needed for the PWM device on the SAMA5D2.

Signed-off-by: Dan Sneddon <dan.sneddon@microchip.com>
2 years agopwm: Add PWM driver for SAMA5D2
Dan Sneddon [Mon, 20 Sep 2021 23:28:44 +0000 (16:28 -0700)]
pwm: Add PWM driver for SAMA5D2

Add support for the PWM found on the SAMA5D2 family of devices.

Signed-off-by: Dan Sneddon <dan.sneddon@microchip.com>
2 years agosunxi: Enable DM_I2C for all sunxi boards
Samuel Holland [Fri, 8 Oct 2021 05:17:25 +0000 (00:17 -0500)]
sunxi: Enable DM_I2C for all sunxi boards

Now that the last users of legacy I2C (outside of SPL) have been
resolved, we can enable DM_I2C at the sunxi architecture level.

Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: video: Convert panel I2C to use DM_I2C
Samuel Holland [Fri, 8 Oct 2021 05:17:24 +0000 (00:17 -0500)]
sunxi: video: Convert panel I2C to use DM_I2C

Two displays supported by the sunxi display driver (each one used by a
single board) require initialization over I2C. Both previously used
i2c_soft; replace this with the i2c-gpio instance that already exists in
those boards' device trees (sun5i-a13-utoo-p66 and sun6i-a31-colombus).

Since the i2c-gpio nodes are not referenced by any other node in the
device trees (the device trees have no panel node), the I2C bus is
selected by its node name.

This panel initialization code was the only i2c_soft user, so the
i2c_soft GPIO setup code can be removed now as well.

Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: pmic_bus: Use the DM PMIC interface when possible
Samuel Holland [Fri, 8 Oct 2021 05:17:23 +0000 (00:17 -0500)]
sunxi: pmic_bus: Use the DM PMIC interface when possible

The pmic_bus functions are used in both SPL (for regulator setup) and
U-Boot proper (for regulator setup, SID access, GPIO, and poweroff).

Currently, pmic_bus conflicts with DM_I2C because it uses the legacy I2C
interface. This commit makes pmic_bus dual-compatible with either the
legacy I2C functions or the newly-added PMIC_AXP driver (which uses
DM_I2C). In turn, this allows platforms to start transitioning to DM_I2C
in U-Boot proper, without breaking boards that still depend on the
legacy I2C interface for other reasons.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: pmic_bus: Clean up preprocessor conditions
Samuel Holland [Fri, 8 Oct 2021 05:17:22 +0000 (00:17 -0500)]
sunxi: pmic_bus: Clean up preprocessor conditions

Instead of using the SoC symbols to decide the bus type, use whichever
bus driver is actually enabled. This allows collapsing all of the AXP2xx
and AXP8xx variants into one "else" case. It also has the advantage of
falling back to I2C when the other bus drivers are disabled; this works
because all of the PMICs support I2C in addition to other interfaces.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoi2c: Add a DM_I2C driver for the sun8i RSB controller
Samuel Holland [Fri, 8 Oct 2021 05:17:21 +0000 (00:17 -0500)]
i2c: Add a DM_I2C driver for the sun8i RSB controller

This bus controller is used to communicate with an X-Powers AXP PMIC.
Currently, various drivers access PMIC registers through a platform-
specific non-DM "pmic_bus" interface, which depends on the legacy I2C
framework. In order to convert those drivers to use DM_PMIC, this bus
needs a DM_I2C driver.

Refactor the rsb functions to take the base address as a parameter,
and implement both the existing interface (which is still needed in
SPL) and the DM_I2C interface on top of them.

The register for switching between I2C/P2WI/RSB mode is the same across
all PMIC variants, so move that to the common header.

There are only a couple of pairs of hardware/runtime addresses used
across all PMIC variants. So far the code expected only the "primary"
pair, but some PMICs like the AXP305 and AXP805 use the secondary pair,
so add support for that to the DM driver as well.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoi2c: Add a DM_I2C driver for the sun6i P2WI controller
Samuel Holland [Fri, 8 Oct 2021 05:17:20 +0000 (00:17 -0500)]
i2c: Add a DM_I2C driver for the sun6i P2WI controller

This bus controller is used to communicate with an X-Powers AXP PMIC.
Currently, various drivers access PMIC registers through a platform-
specific non-DM "pmic_bus" interface, which depends on the legacy I2C
framework. In order to convert those drivers to use DM_PMIC, this bus
needs a DM_I2C driver.

Refactor the p2wi functions to take the base address as a parameter,
and implement both the existing interface (which is still needed in
SPL) and the DM_I2C interface on top of them.

The register for switching between I2C/P2WI/RSB mode is the same across
all PMIC variants. Move that to the common header, so it can be used by
both interface implementations.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: pmic_bus: Fix Kconfig dependencies
Samuel Holland [Fri, 8 Oct 2021 05:17:19 +0000 (00:17 -0500)]
sunxi: pmic_bus: Fix Kconfig dependencies

AXP_PMIC_BUS enables communication with a specific AXP PMIC at a
PMIC-dependent I2C/P2WI/RSB bus address. It is automatically selected
as a dependency of the PMIC driver. It should not be selectable by the
user when no PMIC is chosen.

AXP_GPIO uses the pmic_bus functions, and also depends on a specific
PMIC header to pick up register definitions.

Both of these changes have no impact on any existing configs, since
the code does not compile if the dependencies are not met.

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: Select SUN8I_RSB more carefully
Samuel Holland [Fri, 8 Oct 2021 05:17:18 +0000 (00:17 -0500)]
sunxi: Select SUN8I_RSB more carefully

SUN8I_RSB should not be selected by MACH_SUN8I, because the hardware
is not present in half of those SoCs (H3/H5, R40, and V3s). Move the
selection to the SoCs where the hardware actually exists.
As it currently stands, selecting that option also requires using it in
some way, which is not the case for one A80 board. Since we have only
three A80 boards in total, we select it their via their defconfigs.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
[Andre: fixing up Sunchip_CX-A99 build]
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: Only initialize legacy I2C when enabled
Samuel Holland [Fri, 8 Oct 2021 05:17:17 +0000 (00:17 -0500)]
sunxi: Only initialize legacy I2C when enabled

CONFIG_SPL_I2C is the wrong symbol to use here. It is the top-level
Kconfig symbol (not specific to either legacy or DM I2C), whereas the
i2c_init() function is specific to legacy I2C. This change fixes a
build failure when enabling SPL_I2C but not SPL_SYS_I2C_LEGACY.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-by: Andre Przywara <andre.przywara@arm.com>
2 years agopower: pmic: Add a driver for X-Powers AXP PMICs
Samuel Holland [Fri, 8 Oct 2021 05:17:16 +0000 (00:17 -0500)]
power: pmic: Add a driver for X-Powers AXP PMICs

These PMICs provide some combination of battery charger, fuel gauge,
GPIOs, regulators, and VBUS routing. These functions are represented
as child nodes in the device tree. Add the minimal driver needed to
probe these child devices and provide the DM_PMIC ops.

Enable the driver by default for SoCs that normally pair with a PMIC.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agopower: pmic: Consistently depend on SPL_DM_PMIC
Samuel Holland [Fri, 8 Oct 2021 05:17:15 +0000 (00:17 -0500)]
power: pmic: Consistently depend on SPL_DM_PMIC

Now that there is a separate symbol to enable DM_PMIC in SPL, update the
the SPL-specific driver symbols to depend on this new option.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>