platform/kernel/u-boot.git
4 years agopinctrl: stm32: Convert to use APIs which support live DT
Patrick Delaunay [Wed, 9 Sep 2020 15:50:14 +0000 (17:50 +0200)]
pinctrl: stm32: Convert to use APIs which support live DT

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
driver can support live DT.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agogpio: stm32: check result of ofnode_phandle_args
Patrick Delaunay [Wed, 9 Sep 2020 16:28:34 +0000 (18:28 +0200)]
gpio: stm32: check result of ofnode_phandle_args

Add test on the size of ofnode_phandle_args result to avoid access
to uninitialized elements in args[] field.

This patch avoids the issue when gpio-ranges cell size is not 3 as
expected, for example:
gpio-ranges = <&pinctrl 0>;
instead of
gpio-ranges = <&pinctrl 0 112 16>;

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agogpio: stm32: cosmetic: cleanup gpio_stm32_probe
Patrick Delaunay [Wed, 9 Sep 2020 16:28:33 +0000 (18:28 +0200)]
gpio: stm32: cosmetic: cleanup gpio_stm32_probe

Move the variables definition at the beggining of the function
gpio_stm32_probe().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoARM: dts: stm32mp1: DT alignment with Linux kernel v5.9-rc4
Patrick Delaunay [Wed, 16 Sep 2020 08:01:32 +0000 (10:01 +0200)]
ARM: dts: stm32mp1: DT alignment with Linux kernel v5.9-rc4

DT alignment with Linux kernel v5.9-rc4 for the STM32MP15x soc
device tree files and the STMicroelectronics boards device tree files.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoMerge branch 'next' of git://git.denx.de/u-boot-usb into next
Tom Rini [Thu, 1 Oct 2020 18:52:56 +0000 (14:52 -0400)]
Merge branch 'next' of git://git.denx.de/u-boot-usb into next

- Assorted XHCI improvements

4 years agoRevert "net: smc911x: Automatically Update ethaddr with MAC"
Tom Rini [Thu, 1 Oct 2020 18:51:58 +0000 (14:51 -0400)]
Revert "net: smc911x: Automatically Update ethaddr with MAC"

Upon further discussion on the mailing list, we should not get in the
situation where the generic code path to set ethaddr/etc correctly does
not work.  Revert this until someone can further debug the smc911x
driver regarding this issue.

This reverts commit 387cbf096e443705fa66776027273ed257ec6ca3.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agousb: xhci-rcar: Add support for R8A774A1 SoC
Lad Prabhakar [Mon, 21 Sep 2020 17:24:09 +0000 (18:24 +0100)]
usb: xhci-rcar: Add support for R8A774A1 SoC

The R8A774A1 is compatible with the generic rcar-gen3-xhci controller.
This patch adds the compatibility flag, to support the xHCI controller.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
4 years agousb: xhci: convert to readx_poll_sleep_timeout()
Chunfeng Yun [Tue, 8 Sep 2020 17:00:03 +0000 (19:00 +0200)]
usb: xhci: convert to readx_poll_sleep_timeout()

Use readx_poll_sleep_timeout() to poll the register status

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agousb: xhci: use macros with parameter to fill ep_info2
Chunfeng Yun [Tue, 8 Sep 2020 17:00:02 +0000 (19:00 +0200)]
usb: xhci: use macros with parameter to fill ep_info2

Use macros with parameter to fill ep_info2, then some macros
for MASK and SHIFT can be removed

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agousb: xhci: convert to TRB_TX_TYPE()
Chunfeng Yun [Tue, 8 Sep 2020 17:00:01 +0000 (19:00 +0200)]
usb: xhci: convert to TRB_TX_TYPE()

Use TRB_TX_TYPE() instead of (TRB_DATA_OUT/IN << TRB_TX_TYPE_SHIFT)

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agousb: xhci: convert to TRB_LEN() and TRB_INTR_TARGET()
Chunfeng Yun [Tue, 8 Sep 2020 17:00:00 +0000 (19:00 +0200)]
usb: xhci: convert to TRB_LEN() and TRB_INTR_TARGET()

For normal TRB fields:
use TRB_LEN(x) instead of ((x) & TRB_LEN_MASK);
and use TRB_INTR_TARGET(x) instead of
(((x) & TRB_INTR_TARGET_MASK) << TRB_INTR_TARGET_SHIFT)

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agousb: xhci: convert to TRB_TYPE()
Chunfeng Yun [Tue, 8 Sep 2020 16:59:59 +0000 (18:59 +0200)]
usb: xhci: convert to TRB_TYPE()

Use TRB_TYPE(p) instead of ((p) << TRB_TYPE_SHIFT)

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agousb: xhci: convert to HCS_MAX_PORTS()
Chunfeng Yun [Tue, 8 Sep 2020 16:59:58 +0000 (18:59 +0200)]
usb: xhci: convert to HCS_MAX_PORTS()

Use HCS_MAX_PORTS(p) instead of
((p & HCS_MAX_PORTS_MASK) >> HCS_MAX_PORTS_SHIFT)

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agousb: xhci: add quirks flag to support MediaTek xHCI 0.96
Chunfeng Yun [Tue, 8 Sep 2020 16:59:57 +0000 (18:59 +0200)]
usb: xhci: add quirks flag to support MediaTek xHCI 0.96

There some vendor quirks for MTK xHCI 0.96 host controller:
1. It defines some extra SW scheduling parameters for HW
   to minimize the scheduling effort for synchronous and
   interrupt endpoints. The parameters are put into reserved
   DWs of slot context and endpoint context.
2. Its TDS in  Normal TRB defines a number of packets that
   remains to be transferred for a TD after processing all
   Max packets in all previous TRBs.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agousb: xhci: create one unified function to calculate TRB TD remainder
Chunfeng Yun [Tue, 8 Sep 2020 16:59:56 +0000 (18:59 +0200)]
usb: xhci: create one unified function to calculate TRB TD remainder

xhci versions 1.0 and later report the untransferred data remaining in a
TD a bit differently than older hosts.

We used to have separate functions for these, and needed to check host
version before calling the right function.

Now Mediatek host has an additional quirk on how it uses the TD Size
field for remaining data. To prevent yet another function for calculating
remainder we instead want to make one quirk friendly unified function.

Porting from the Linux:
c840d6ce772d("xhci: create one unified function to calculate TRB TD remainder.")
124c39371114("xhci: use boolean to indicate last trb in td remainder calculation")

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agousb: xhci: add a member hci_version in xhci_ctrl struct
Chunfeng Yun [Tue, 8 Sep 2020 16:59:55 +0000 (18:59 +0200)]
usb: xhci: add a member hci_version in xhci_ctrl struct

Add a member to save xHCI version, it's used some times.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoMerge branch 'next' of git://git.denx.de/u-boot-sh into next
Tom Rini [Thu, 1 Oct 2020 14:29:39 +0000 (10:29 -0400)]
Merge branch 'next' of git://git.denx.de/u-boot-sh into next

4 years agoMerge branch '2020-09-30-assorted-network-improvements' into next
Tom Rini [Thu, 1 Oct 2020 13:46:10 +0000 (09:46 -0400)]
Merge branch '2020-09-30-assorted-network-improvements' into next

- Generic UDP framework
- TFTP fixes
- dwc_eth_qos, smc911x, smc911x and mscc phy fixes

4 years agosntp: use udp framework
Philippe Reynes [Fri, 18 Sep 2020 12:13:02 +0000 (14:13 +0200)]
sntp: use udp framework

This commits update the support of sntp to use
the framework udp. This change allows to remove
all the reference to sntp in the main network
file net/net.c.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: enable support of generic udp protocol
Philippe Reynes [Fri, 18 Sep 2020 12:13:01 +0000 (14:13 +0200)]
sandbox: enable support of generic udp protocol

This commit enable the support of the generic udp protocol.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agonet: add a generic udp protocol
Philippe Reynes [Fri, 18 Sep 2020 12:13:00 +0000 (14:13 +0200)]
net: add a generic udp protocol

This commit adds a generic udp protocol framework in the
network loop. So protocol based on udp may be implemented
without modifying the network loop (for example custom
wait magic packet).

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agonet: dwc_eth_qos: Convert to use APIs which support live DT
Patrick Delaunay [Wed, 9 Sep 2020 16:30:06 +0000 (18:30 +0200)]
net: dwc_eth_qos: Convert to use APIs which support live DT

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
driver can support live DT.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agophy: add support for stingray PAXB PHY controller
Srinath Mannam [Thu, 2 Apr 2020 10:38:12 +0000 (16:08 +0530)]
phy: add support for stingray PAXB PHY controller

Add support for stingray PAXB PHY controller driver.
This driver supports maximum 8 PAXB phys using pipemux data.

Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agonet: use log_err() for 'No ethernet found' message
Heinrich Schuchardt [Mon, 14 Sep 2020 09:00:18 +0000 (11:00 +0200)]
net: use log_err() for 'No ethernet found' message

Write the 'No ethernet found' message via the log drivers. This allows
suppressing it during output via the syslog driver.

This fixes the problem reported in:

[PATCH 0/4] log: Fix the syslog spam when running tests
https://lists.denx.de/pipermail/u-boot/2020-September/426343.html

Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agonet: tftp: Fix load_block offset calculation
Ley Foon Tan [Tue, 25 Aug 2020 02:26:37 +0000 (10:26 +0800)]
net: tftp: Fix load_block offset calculation

When load the last block, the "len" might not be a block size. This cause
loading the incorrect last block data.

The fix change "len" to tftp_block_size and minus one tftp_block_size
for offset calculation.

Use same offset calculation formula as in store_block().

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
4 years agonet: tftp: Fix store_block offset calculation
Ley Foon Tan [Tue, 25 Aug 2020 02:26:36 +0000 (10:26 +0800)]
net: tftp: Fix store_block offset calculation

tftp_cur_block start with 1 for first block, but tftp_cur_block counter is
start with zero when block number is rollover. The existing code
"tftp_cur_block - 1" will cause the block number become -1 in store_block()
when tftp_cur_block is 0 when tftp_cur_block is rollover.

The fix pass in tftp_cur_block to store_block() and minus the
tftp_block_size when do the offset calculation.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
4 years agonet: tftp: Fix tftp_prev_block counter update
Ley Foon Tan [Tue, 25 Aug 2020 02:26:35 +0000 (10:26 +0800)]
net: tftp: Fix tftp_prev_block counter update

Fixes missing update to tftp_prev_block counter before increase
tftp_cur_block counter when do the tftpput operation.

tftp_prev_block counter is used in update_block_number() function to
check whether block number (sequence number) is rollover. This bug
cause the tftpput command fail to upload a large file when block
number is greater than 16-bit (0xFFFF).

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
4 years agonet: smc911x: Automatically Update ethaddr with MAC
Adam Ford [Tue, 18 Aug 2020 13:19:02 +0000 (08:19 -0500)]
net: smc911x: Automatically Update ethaddr with MAC

The ethernet controller can read the MAC from EEPROM and display it,
but if ethaddr is not set, the ethernet is still unavailable.

This patch checks will automatically set the MAC address if it has
not already been set.

Signed-off-by: Adam Ford <aford173@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: ftgmac100: Add support for board specific PHY interface address
Thirupathaiah Annapureddy [Tue, 18 Aug 2020 00:08:26 +0000 (17:08 -0700)]
net: ftgmac100: Add support for board specific PHY interface address

ftgmac100 driver is using hard-coded PHY interface address of zero.
Each board can have different PHY interface address (phy_addr).
This commit modifies the driver to make use of board specific address
by leveraging CONFIG_PHY_ADDR.

Signed-off-by: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
4 years agonet: phy: mscc: sync rx/tx delay settings with Linux on vsc85xx
Heiko Stuebner [Tue, 9 Jun 2020 13:37:40 +0000 (15:37 +0200)]
net: phy: mscc: sync rx/tx delay settings with Linux on vsc85xx

The Linux kernel does set the clock delays to
- 0.2 ns (their default, and lowest, hardware value) if delays should
  not be enabled
- 2.0 ns (which causes the data to be sampled at exactly half way between
  clock transitions at 1000 Mbps) if delays should be enabled
depending on the interface mode

See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/phy/mscc/mscc_main.c#n523

So instead of using arbitrary delay values like now, mimic this behaviour.

The behaviour is the same for all of vsc8530/8531/8540/8541 so move that
to a shared function while at it.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
4 years agonet: phy: mscc: make clock-output configurable on vsc85xx
Heiko Stuebner [Tue, 9 Jun 2020 13:37:39 +0000 (15:37 +0200)]
net: phy: mscc: make clock-output configurable on vsc85xx

The vsc8530/8531/8540/8541 phys have a configurable clock output that
can emit 25, 50 and 125 MHz rates, which in turn may be needed for
stable network connections.

This follows a similar change introduced into the Linux kernel at
  https://lore.kernel.org/netdev/20200609133140.1421109-2-heiko@sntech.de

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
4 years agoMerge branch '2020-09-30-add-new-apis' into next
Tom Rini [Wed, 30 Sep 2020 20:11:11 +0000 (16:11 -0400)]
Merge branch '2020-09-30-add-new-apis' into next

- SCMI firmware support
- regmap, GPIO, reset API enhancements

4 years agofirmware: smci: sandbox test for SCMI reset controllers
Etienne Carriere [Wed, 9 Sep 2020 16:44:07 +0000 (18:44 +0200)]
firmware: smci: sandbox test for SCMI reset controllers

Add tests for SCMI reset controllers. A test device driver
sandbox-scmi_devices.c is used to get reset resources, allowing further
resets manipulation.

Change sandbox-smci_agent to emulate 1 reset controller exposed through
an agent. Add DM test scmi_resets to test this reset controller.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoreset: add reset controller driver for SCMI agents
Etienne Carriere [Wed, 9 Sep 2020 16:44:06 +0000 (18:44 +0200)]
reset: add reset controller driver for SCMI agents

This change introduces a reset controller driver for SCMI agent devices.
When SCMI agent and SCMI reset domain drivers are enabled, SCMI agent
binds a reset controller device for each SCMI reset domain protocol
devices enabled in the FDT.

SCMI reset driver is embedded upon CONFIG_RESET_SCMI=y. If enabled,
CONFIG_SCMI_AGENT is also enabled.

SCMI Reset Domain protocol is defined in the SCMI specification [1].

Links: [1] https://developer.arm.com/architectures/system-architectures/software-standards/scmi
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agofirmware: scmi: sandbox test for SCMI clocks
Etienne Carriere [Wed, 9 Sep 2020 16:44:05 +0000 (18:44 +0200)]
firmware: scmi: sandbox test for SCMI clocks

Add tests for SCMI clocks. A test device driver sandbox-scmi_devices.c
is used to get clock resources, allowing further clock manipulation.

Change sandbox-smci_agent to emulate 3 clocks exposed through 2 agents.
Add DM test scmi_clocks to test these 3 clocks.
Update DM test sandbox_scmi_agent with load/remove test sequences
factorized by {load|remove}_sandbox_scmi_test_devices() helper functions.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoclk: add clock driver for SCMI agents
Etienne Carriere [Wed, 9 Sep 2020 16:44:04 +0000 (18:44 +0200)]
clk: add clock driver for SCMI agents

This change introduces a clock driver for SCMI agent devices. When
SCMI agent and SCMI clock drivers are enabled, SCMI agent binds a
clock device for each SCMI clock protocol devices enabled in the FDT.

SCMI clock driver is embedded upon CONFIG_CLK_SCMI=y. If enabled,
CONFIG_SCMI_AGENT is also enabled.

SCMI Clock protocol is defined in the SCMI specification [1].

Links: [1] https://developer.arm.com/architectures/system-architectures/software-standards/scmi
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodt-bindings: arm: SCMI bindings documentation
Etienne Carriere [Wed, 9 Sep 2020 16:44:03 +0000 (18:44 +0200)]
dt-bindings: arm: SCMI bindings documentation

Dump SCMI DT bindings documentation from Linux kernel source
tree v5.8-rc1.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agofirmware: scmi: support Arm SMCCC transport
Etienne Carriere [Wed, 9 Sep 2020 16:44:02 +0000 (18:44 +0200)]
firmware: scmi: support Arm SMCCC transport

This change implements a SMCCC transport for SCMI exchanges. This
implementation follows the Linux kernel as references implementation
for SCMI message processing, using the SMT format for communication
channel meta-data.

Use of SMCCC transport in SCMI FDT bindings are defined in the Linux
kernel DT bindings since v5.8. SMCCC with SMT is implemented in OP-TEE
from tag 3.9.0 [2].

Links: [2] https://github.com/OP-TEE/optee_os/commit/a58c4d706d23
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agofirmware: scmi: mailbox/smt agent device
Etienne Carriere [Wed, 9 Sep 2020 16:44:01 +0000 (18:44 +0200)]
firmware: scmi: mailbox/smt agent device

This change implements a mailbox transport using SMT format for SCMI
exchanges. This implementation follows the Linux kernel and
SCP-firmware [1] as references implementation for SCMI message
processing using SMT format for communication channel meta-data.

Use of mailboxes in SCMI FDT bindings are defined in the Linux kernel
DT bindings since v4.17.

Links: [1] https://github.com/ARM-software/SCP-firmware
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agofirmware: add SCMI agent uclass
Etienne Carriere [Wed, 9 Sep 2020 16:44:00 +0000 (18:44 +0200)]
firmware: add SCMI agent uclass

This change introduces SCMI agent uclass to interact with a firmware
using the SCMI protocols [1].

SCMI agent uclass currently supports a single method to request
processing of the SCMI message by an identified server. A SCMI message
is made of a byte payload associated to a protocol ID and a message ID,
all defined by the SCMI specification [1]. On return from process_msg()
method, the caller gets the service response.

SCMI agent uclass defines a post bind generic sequence for all devices.
The sequence binds all the SCMI protocols listed in the FDT for that
SCMI agent device. Currently none, but later change will introduce
protocols.

This change implements a simple sandbox device for the SCMI agent uclass.
The sandbox nicely answers SCMI_NOT_SUPPORTED to SCMI messages.
To prepare for further test support, the sandbox exposes a architecture
function for test application to read the sandbox emulated devices state.
Currently supports 2 SCMI agents, identified by an ID in the FDT device
name. The simplistic DM test does nothing yet.

SCMI agent uclass is designed for platforms that embed a SCMI server in
a firmware hosted somewhere, for example in a companion co-processor or
in the secure world of the executing processor. SCMI protocols allow an
SCMI agent to discover and access external resources as clock, reset
controllers and more. SCMI agent and server communicate following the
SCMI specification [1]. This SCMI agent implementation complies with
the DT bindings defined in the Linux kernel source tree regarding
SCMI agent description since v5.8.

Links: [1] https://developer.arm.com/architectures/system-architectures/software-standards/scmi
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotest: dm: Add tests for regmap managed API and regmap fields
Jean-Jacques Hiblot [Thu, 24 Sep 2020 04:34:18 +0000 (10:04 +0530)]
test: dm: Add tests for regmap managed API and regmap fields

The tests rely on a dummy driver to allocate and initialize the regmaps
and the regmap fields using the managed API. The first test checks if
the regmap config fields like width, reg_offset_shift, range specifiers,
etc work. The second test checks if regmap fields behave properly (mask
and shift are ok) by peeking into the regmap.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotest/py: allow multi-digit index in in_tree()
Pratyush Yadav [Thu, 24 Sep 2020 04:34:17 +0000 (10:04 +0530)]
test/py: allow multi-digit index in in_tree()

When more nodes are added for a uclass the index might go into two or
more digits. This means that there are less spaces printed because they
are used up by the extra digits. Update the regular expression to allow
variable-length spacing between the class name and and index.

This was discovered when adding a simple_bus node in test.dts made
test_bind_unbind_with_uclass() fail because the index went up to 10.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
4 years agoregmap: Add support for regmap fields
Jean-Jacques Hiblot [Thu, 24 Sep 2020 04:34:16 +0000 (10:04 +0530)]
regmap: Add support for regmap fields

A regmap field is an abstraction available in Linux. It provides to access
bitfields in a regmap without having to worry about shifts and masks.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
4 years agoregmap: Allow devices to specify regmap range start and size in config
Pratyush Yadav [Thu, 24 Sep 2020 04:34:15 +0000 (10:04 +0530)]
regmap: Allow devices to specify regmap range start and size in config

Some devices need to calculate the regmap base address at runtime. This
makes it impossible to use device tree to get the regmap base. Instead,
allow devices to specify it in the regmap config. This will create a
regmap with a single range that corresponds to the start and size given
by the driver.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoregmap: Add regmap_init_mem_range()
Pratyush Yadav [Thu, 24 Sep 2020 04:34:14 +0000 (10:04 +0530)]
regmap: Add regmap_init_mem_range()

Right now, the base of a regmap can only be obtained from the device
tree. This makes it impossible for devices which calculate the base at
runtime to use a regmap. An example of such a device is the Cadence
Sierra PHY.

Allow creating a regmap with one range whose start and size can be
specified by the driver based on calculations at runtime.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoregmap: Allow left shifting register offset before access
Pratyush Yadav [Thu, 24 Sep 2020 04:34:13 +0000 (10:04 +0530)]
regmap: Allow left shifting register offset before access

Drivers can configure it to adjust the final read/write location.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoregmap: Allow specifying read/write width
Pratyush Yadav [Thu, 24 Sep 2020 04:34:12 +0000 (10:04 +0530)]
regmap: Allow specifying read/write width

Right now, regmap_read() and regmap_write() read/write a 32-bit value
only. To write other lengths, regmap_raw_read() and regmap_raw_write()
need to be used.

This means that any driver ported from Linux that relies on
regmap_{read,write}() to know the size already has to be updated at each
callsite. This makes the port harder to maintain.

So, allow specifying the read/write width to make it easier to port the
drivers, since now the only change needed is when initializing the
regmap.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoregmap: zero out the regmap on allocation
Pratyush Yadav [Thu, 24 Sep 2020 04:34:11 +0000 (10:04 +0530)]
regmap: zero out the regmap on allocation

Some fields will be introduced in the regmap structure that should be
set to 0 by default. So, once we allocate a regmap, make sure it is
zeroed out to avoid unexpected defaults for those values.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoregmap: Add devm_regmap_init()
Jean-Jacques Hiblot [Thu, 24 Sep 2020 04:34:10 +0000 (10:04 +0530)]
regmap: Add devm_regmap_init()

Most of new linux drivers are using managed-API to allocate resources. To
ease porting drivers from linux to U-Boot, introduce devm_regmap_init() as
a managed API to get a regmap from the device tree.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
4 years agotest: gpio: Add tests for the managed API
Jean-Jacques Hiblot [Fri, 11 Sep 2020 08:13:35 +0000 (13:43 +0530)]
test: gpio: Add tests for the managed API

Add a test to verify that GPIOs can be acquired/released using the managed
API. Also check that the GPIOs are released when the consumer device is
removed.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
4 years agodrivers: gpio: Add a managed API to get a GPIO from the device-tree
Jean-Jacques Hiblot [Fri, 11 Sep 2020 08:13:34 +0000 (13:43 +0530)]
drivers: gpio: Add a managed API to get a GPIO from the device-tree

Add managed functions to get a gpio from the devce-tree, based on a
property name (minus the '-gpios' suffix) and optionally an index.

When the device is unbound, the GPIO is automatically released and the
data structure is freed.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
4 years agotest: reset: Add tests for the managed API
Jean-Jacques Hiblot [Wed, 9 Sep 2020 10:07:04 +0000 (15:37 +0530)]
test: reset: Add tests for the managed API

The tests are basically the same as for the regular API. Except that
the reset are initialized using the managed API, and no freed manually.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
4 years agodrivers: reset: Add a managed API to get reset controllers from the DT
Jean-Jacques Hiblot [Wed, 9 Sep 2020 10:07:03 +0000 (15:37 +0530)]
drivers: reset: Add a managed API to get reset controllers from the DT

Add managed functions to get a reset_ctl from the device-tree, based on a
name or an index.
Also add a managed functions to get a reset_ctl_bulk (array of reset_ctl)
from the device-tree.

When the device is unbound, the reset controllers are automatically
released and the data structure is freed.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
4 years agoMerge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-riscv into...
Tom Rini [Wed, 30 Sep 2020 13:21:43 +0000 (09:21 -0400)]
Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-riscv into next

- Disable CMD_IRQ for RISC-V.
- Update sipeed/maix doc
- Obtain reg of SiFive RAM via dev_read_addr_index() instead of regmap API.
- Cleans up RISC-V timer drivers and converts them to DM.
- Correctly handle IPIs already pending upon prior stage bootloader (on the K210)

4 years agoMerge branch '2020-09-29-dev_xxx-print-improvement' into next
Tom Rini [Wed, 30 Sep 2020 13:07:06 +0000 (09:07 -0400)]
Merge branch '2020-09-29-dev_xxx-print-improvement' into next

- Improve our dev_xxx(..) wrappers to be generally used and available
  rather than discarded at link/compile time.

4 years agodm: Print device name in dev_xxx like Linux
Sean Anderson [Tue, 15 Sep 2020 14:45:22 +0000 (10:45 -0400)]
dm: Print device name in dev_xxx like Linux

This adorns messages generated by dev_xxx with the device and driver
names. It also redirects dev_xxx to log when it is available. The names
of these functions very roughly take inspiration from Linux, but there is
no deeper correlation.

Both struct udevice and struct device are supported when logging, though
logging with struct device is no better than using log_xxx. The latter is
supported because of the large amount of existing code which logs with
struct device.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agodm: Use symbolic constants for log levels in dev_xxx
Sean Anderson [Tue, 15 Sep 2020 14:45:21 +0000 (10:45 -0400)]
dm: Use symbolic constants for log levels in dev_xxx

This substitutes literal log levels with their symbolic constants.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agovideo: stm32: Fix not calling dev_xxx with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:20 +0000 (10:45 -0400)]
video: stm32: Fix not calling dev_xxx with a device

There is no member `dev` in dw_mipi_dsi, but there is one in mipi_dsi_host,
so use that.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agousb: musb-new: sunxi: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:19 +0000 (10:45 -0400)]
usb: musb-new: sunxi: Fix not calling dev_err with a device

This driver does not use DM, so we need to use a struct device instead of a
struct udevice. Not ideal, but it'll have to do for now.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agousb: dwc3: Don't include asm-generic/io.h
Sean Anderson [Tue, 15 Sep 2020 14:45:18 +0000 (10:45 -0400)]
usb: dwc3: Don't include asm-generic/io.h

This can conflict with asm/io.h on some archs, and it isn't needed to build
dwc3-generic.c

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agousb: dwc3: ti: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:17 +0000 (10:45 -0400)]
usb: dwc3: ti: Fix not calling dev_err with a device

This driver does not use DM, so use log_xxx instead.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agousb: dwc3: Fix not calling dev_xxx with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:16 +0000 (10:45 -0400)]
usb: dwc3: Fix not calling dev_xxx with a device

This logs with the device from struct dwc3. Some files also need to include
dm.h so fields in udevice can be accessed.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agousb: dwc2: Fix not calling dev_xxx with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:15 +0000 (10:45 -0400)]
usb: dwc2: Fix not calling dev_xxx with a device

This adds a dev argument to some functions so dev_xxx always has a device
to log with. In one instance we must use use a different log function when
we are compiled without DM_USB.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agousb: cdns3: Fix not calling dev_xxx with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:14 +0000 (10:45 -0400)]
usb: cdns3: Fix not calling dev_xxx with a device

ep0.c also need to include dm.h so dev_xxx can access udevice fields.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agosysreset: ti: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:13 +0000 (10:45 -0400)]
sysreset: ti: Fix not calling dev_err with a device

The rst variable doesn't exist.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agospi: zynqmp_gqspi: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:12 +0000 (10:45 -0400)]
spi: zynqmp_gqspi: Fix not calling dev_err with a device

Use `bus` instead of `dev`.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agospi: sunxi: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:11 +0000 (10:45 -0400)]
spi: sunxi: Fix not calling dev_err with a device

Use `bus` and not `dev`.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agosoc: qualcomm: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:10 +0000 (10:45 -0400)]
soc: qualcomm: Fix not calling dev_err with a device

Remove the indirection.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoremoteproc: k3: Fix not calling dev_xxx with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:09 +0000 (10:45 -0400)]
remoteproc: k3: Fix not calling dev_xxx with a device

Pass a device to functions which log with one.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoremoteproc: k3-r5: Fix not calling dev_xxx with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:08 +0000 (10:45 -0400)]
remoteproc: k3-r5: Fix not calling dev_xxx with a device

Usually we can get a device from the current core, but some dev_dbg calls
have been converted to debug, since we are called on a cluster.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoremoteproc: Remove unused function rproc_elf_sanity_check
Sean Anderson [Tue, 15 Sep 2020 14:45:07 +0000 (10:45 -0400)]
remoteproc: Remove unused function rproc_elf_sanity_check

This function is never used anywhere, and it also tries to log with a
nonexistant device.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agophy: usbphyc: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:06 +0000 (10:45 -0400)]
phy: usbphyc: Fix not calling dev_err with a device

Use the phy's device.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agophy: ti: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:05 +0000 (10:45 -0400)]
phy: ti: Fix not calling dev_err with a device

`phy` doesn't exist; we need to use `x` instead.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agophy: sun4i-usb: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:04 +0000 (10:45 -0400)]
phy: sun4i-usb: Fix not calling dev_err with a device

This uses phy's device

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agophy: rockchip: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:03 +0000 (10:45 -0400)]
phy: rockchip: Fix not calling dev_err with a device

Get the device from phy, or pass the phy in.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agophy: marvell: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:02 +0000 (10:45 -0400)]
phy: marvell: Fix not calling dev_err with a device

No need for indirection here.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonet: ti: cpsw: Fix not calling dev_dbg with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:01 +0000 (10:45 -0400)]
net: ti: cpsw: Fix not calling dev_dbg with a device

Without DM_ETH, cpsw_priv.dev is an eth_device. Just use its name instead.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonet: sun8i_emac: Fix not calling dev_xxx with a device
Sean Anderson [Tue, 15 Sep 2020 14:45:00 +0000 (10:45 -0400)]
net: sun8i_emac: Fix not calling dev_xxx with a device

Pass a udevice into a few functions so `dev` is defined.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonet: sunxi: Fix not calling dev_xxx with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:59 +0000 (10:44 -0400)]
net: sunxi: Fix not calling dev_xxx with a device

There's no dev to log with, so pass the device along with the priv data.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agolinux/compat.h: Remove netdev_xxx functions
Sean Anderson [Tue, 15 Sep 2020 14:44:58 +0000 (10:44 -0400)]
linux/compat.h: Remove netdev_xxx functions

No drivers in U-Boot use these functions.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonet: mvpp2: Convert netdev_xxx to dev_xxx
Sean Anderson [Tue, 15 Sep 2020 14:44:57 +0000 (10:44 -0400)]
net: mvpp2: Convert netdev_xxx to dev_xxx

netdev_xxx evaluates to printf in U-Boot, so there is no extra info
printed. mvpp2 one of only two drivers which use these functions in U-Boot.
Convert these functions to dev_xxx where possible (and to log_xxx where
not).

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonet: mvpp2: Fix not calling dev_xxx with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:56 +0000 (10:44 -0400)]
net: mvpp2: Fix not calling dev_xxx with a device

Remove some prefixes, or get the device from the phy.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonet: mvneta: Convert netdev_xxx to dev_xxx
Sean Anderson [Tue, 15 Sep 2020 14:44:55 +0000 (10:44 -0400)]
net: mvneta: Convert netdev_xxx to dev_xxx

netdev_xxx evaluates to printf in U-Boot, so there is no extra info
printed. mvneta is one of two drivers which use these functions in U-Boot.
Convert these functions to dev_xxx where possible (and to log_xxx where
not).

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonet: mvneta: Fix not always calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:54 +0000 (10:44 -0400)]
net: mvneta: Fix not always calling dev_err with a device

No need for indirection here.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonet: mdio: Fix not calling dev_dbg with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:53 +0000 (10:44 -0400)]
net: mdio: Fix not calling dev_dbg with a device

The name of the device we are working on is `ethdev` and not just `dev`.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonet: bcm6368: Fix not calling dev_info with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:52 +0000 (10:44 -0400)]
net: bcm6368: Fix not calling dev_info with a device

Remove the pdev indirection.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonand: vybrid: Re-introduce vf610_nfc.dev
Sean Anderson [Tue, 15 Sep 2020 14:44:51 +0000 (10:44 -0400)]
nand: vybrid: Re-introduce vf610_nfc.dev

This member was presumably dropped when this driver was converted from
Linux. However, it is still used in log statements during initialization.
This patch adds the member back. In addition, allocation of struct
vf610_nfc has been moved to the callers of vf610_nfc_nand_init. This allows
it to be allocated by DM (if it is being used) and for dev to be
initialized.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonand: brcmnand: Fix not calling dev_err() with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:50 +0000 (10:44 -0400)]
nand: brcmnand: Fix not calling dev_err() with a device

There are too many levels of indirection when calling dev_err. This is an
artifact of the conversion of brcmnand_host.pdev from a struct
platform_device (which has a member `dev` pointing to a struct device) to
struct udevice.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonand: atmel: Fix not calling dev_xxx with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:49 +0000 (10:44 -0400)]
nand: atmel: Fix not calling dev_xxx with a device

Use mtd_info to get a device to log with.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agomailbox: k3: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:48 +0000 (10:44 -0400)]
mailbox: k3: Fix not calling dev_err with a device

dev needs to be gotten from mbox_chan

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agommc: mtk-sd: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:47 +0000 (10:44 -0400)]
mmc: mtk-sd: Fix not calling dev_err with a device

This adds a udevice parameter to get_best_delay and msdc_set_mclk so they
can call dev_err properly.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agommc: bcm2835-host: Fix not calling dev_dbg with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:46 +0000 (10:44 -0400)]
mmc: bcm2835-host: Fix not calling dev_dbg with a device

dev needs to be qualified as a member of host.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agommc: Add mmc_dev()
Sean Anderson [Tue, 15 Sep 2020 14:44:45 +0000 (10:44 -0400)]
mmc: Add mmc_dev()

This macro is necessary for arasan_zynqmp_dll_reset to compile.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agomtd: spi-nand: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:44 +0000 (10:44 -0400)]
mtd: spi-nand: Fix not calling dev_err with a device

Get it from spinand->slave->dev. Another option would be to use
spinand_to_mtd(spinand)->dev, but this is what the existing code uses.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agomtd: spi: Fix logging in spi-nor-tiny
Sean Anderson [Tue, 15 Sep 2020 14:44:43 +0000 (10:44 -0400)]
mtd: spi: Fix logging in spi-nor-tiny

This fixes dev_xxx() not always being called with a device. In
spi_nor_reg_read, a the slave device may not always be available, so we use
bus and cs instead.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agomtd: spi: Include dm.h in spi-nor-core.c
Sean Anderson [Tue, 15 Sep 2020 14:44:42 +0000 (10:44 -0400)]
mtd: spi: Include dm.h in spi-nor-core.c

This header is needed so struct udevice can be used in dev_xxx().

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agomtd: nand: sunxi: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:41 +0000 (10:44 -0400)]
mtd: nand: sunxi: Fix not calling dev_err with a device

Usually the device is gotten from sunxi_nfc. This is a struct device and
not a struct udevice, but the whole driver seems to be written wihout DM
anyway...

In a few instances, this patch modifies functions to take an nfc to log
with. In once instance we use mtd_info's device since there is no nfc.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agomtd: nand: pxa3xx: Fix not calling dev_xxx with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:40 +0000 (10:44 -0400)]
mtd: nand: pxa3xx: Fix not calling dev_xxx with a device

Use the device from any mtd already available, or from the active mtd via
pxa3xx_nand_info if one is not.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoi2c: mxc: Fix dev_err being called on a nonexistant variable
Sean Anderson [Tue, 15 Sep 2020 14:44:39 +0000 (10:44 -0400)]
i2c: mxc: Fix dev_err being called on a nonexistant variable

The udevice we are working with is called `bus` and not `dev`.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agofirmware: ti_sci: Fix not calling dev_err with a device
Sean Anderson [Tue, 15 Sep 2020 14:44:38 +0000 (10:44 -0400)]
firmware: ti_sci: Fix not calling dev_err with a device

This converts calls to dev_err to get the device from ti_sci_info where
appropriate.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>