platform/kernel/u-boot.git
19 months agonet: CONFIG_NET_DEVICES in dhcp_handler()
Heinrich Schuchardt [Sat, 26 Nov 2022 15:32:25 +0000 (16:32 +0100)]
net: CONFIG_NET_DEVICES in dhcp_handler()

The symbol CONFIG_NET_DEVICES does not exist.
The correct name is CONFIG_NETDEVICES.

Fixes: 77b5c4a5b1dc ("efi_loader: Let networking support depend on NETDEVICES")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
19 months agodisk: fix blk_get_device_part_str()
Heinrich Schuchardt [Sun, 20 Nov 2022 10:23:24 +0000 (11:23 +0100)]
disk: fix blk_get_device_part_str()

blk_get_device_part_str() should always initialize all info fields
including sys_ind. As a side effect the code is simplified.

Replace '(0 ==' by '(!' to conform with Linux coding style.

Fixes: 4d907025d6a5 ("sandbox: restore ability to access host fs through standard commands")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
19 months agoconsole: file should always be non-negative
Heinrich Schuchardt [Sat, 22 Oct 2022 09:32:34 +0000 (11:32 +0200)]
console: file should always be non-negative

We use the parameter file in console functions to choose from an array
after checking against MAX_FILES but we never check if the value of file
is negative.

Running ./u-boot -T -l and issuing the poweroff command has resulted in
crashes because os_exit() results in std::ostream::flush() calling U-Boot's
fflush with file being a pointer which when converted to int may be
represented by a negative number.

This shows that checking against MAX_FILES is not enough. We have to ensure
that the file argument is always positive.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoMerge branch '2022-12-02-assorted-updates'
Tom Rini [Fri, 2 Dec 2022 15:00:55 +0000 (10:00 -0500)]
Merge branch '2022-12-02-assorted-updates'

- Add Peter Robinson as a co-custodian for Pi, update the maintainer
  record for common/usb_storage.c, re-add bmp_logo to tools-only and fix
  SPI booting on the SanCloud BBE

19 months agoMAINTAINERS: Adopt SanCloud boards
Paul Barker [Mon, 14 Nov 2022 12:42:43 +0000 (12:42 +0000)]
MAINTAINERS: Adopt SanCloud boards

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
Cc: Marc Murphy <marc.murphy@sancloud.com>
19 months agoam335x-sancloud-bbe: Add -u-boot.dtsi files
Paul Barker [Mon, 14 Nov 2022 12:42:42 +0000 (12:42 +0000)]
am335x-sancloud-bbe: Add -u-boot.dtsi files

The SanCloud BBE requires the same dtb nodes to be present in the SPL as
the AM335x EVM.

The SanCloud BBE Lite also requires the SPI flash node and all
dependencies to be present in the SPL to support SPI boot.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
19 months agoam335x-sancloud-bbe-lite: SPI flash is JEDEC compatible
Paul Barker [Mon, 14 Nov 2022 12:42:41 +0000 (12:42 +0000)]
am335x-sancloud-bbe-lite: SPI flash is JEDEC compatible

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
19 months agoam335x-evm: Support STMicro/Micron SPI flash
Paul Barker [Mon, 14 Nov 2022 12:42:40 +0000 (12:42 +0000)]
am335x-evm: Support STMicro/Micron SPI flash

This change enables access to the SPI flash on the SanCloud BBE Lite
board.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
19 months agoam335x-evm: Fix spiboot configuration
Paul Barker [Mon, 14 Nov 2022 12:42:39 +0000 (12:42 +0000)]
am335x-evm: Fix spiboot configuration

The advanced address translation provided by CONFIG_SPL_OF_TRANSLATE is
needed to determine the base address of the uart0 peripheral on am335x
platforms when CONFIG_SPL_OF_CONTROL is enabled.

If CONFIG_SPL_OF_CONTROL is enabled in the base (non-spiboot)
am335x_evm_defconfig, then CONFIG_SPL_OF_TRANSLATE will also need to be
enabled there. Unfortunately this cannot be done pre-emptively due to
the kconfig dependencies.

The TI clk-ctrl & TI sysc drivers are also required to bring up the SPI
bus on am335x platforms.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
19 months agoam335x-evm: Enable required dtb nodes in SPL
Paul Barker [Mon, 14 Nov 2022 12:42:38 +0000 (12:42 +0000)]
am335x-evm: Enable required dtb nodes in SPL

For successful boot when CONFIG_SPL_OF_CONTROL=y, we need to ensure that
the board EEPROM on i2c0, the uart0 serial port and the relevant boot
device (mmc1 or mmc2) can be accessed in the SPL. We also need to
preserve the parent nodes for each required dtb node.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
19 months agobus: Optionally include TI sysc driver in SPL/TPL
Paul Barker [Mon, 14 Nov 2022 12:42:37 +0000 (12:42 +0000)]
bus: Optionally include TI sysc driver in SPL/TPL

The TI sysc bus driver is required to allow access to the SPI bus on
am335x platforms. To support SPI boot this driver needs to be enabled in
the SPL/TPL as appropriate.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
19 months agobus: TI sysc driver requires DM
Paul Barker [Mon, 14 Nov 2022 12:42:36 +0000 (12:42 +0000)]
bus: TI sysc driver requires DM

This driver does not build if CONFIG_DM is disabled as it uses the
function `dev_get_priv`.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
19 months agodm: core: Fix iteration over driver_info records
Paul Barker [Mon, 14 Nov 2022 12:42:35 +0000 (12:42 +0000)]
dm: core: Fix iteration over driver_info records

We should only perform additional iteration steps when needed to
initialize the parent of a device. Other binding errors (such as a
missing driver) should not lead to additional iteration steps.

Unnecessary iteration steps can cause issues when memory is tightly
constrained (such as in the TPL/SPL) since device_bind_by_name()
unconditionally allocates memory for a struct udevice. On the SanCloud
BBE this led to boot failure caused by memory exhaustion in the SPL
when booting from SPI flash.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
19 months agoMAINTAINERS: Move usb_storage from DFU to USB
Marek Vasut [Fri, 4 Nov 2022 11:28:07 +0000 (12:28 +0100)]
MAINTAINERS: Move usb_storage from DFU to USB

The usb_storage.c is the host-side USB mass storage device support,
it is not the DFU/UMS gadget-side implementation. Fix the entry.

Signed-off-by: Marek Vasut <marex@denx.de>
19 months agoconfig: tools only: add VIDEO to build bmp_logo
Peter Robinson [Thu, 24 Nov 2022 14:05:59 +0000 (14:05 +0000)]
config: tools only: add VIDEO to build bmp_logo

Pre 2023.01 the bmp_logo was built as part of the tools-only_defconfig
build, something changed and the VIDEO dep needed to build it
is no longer pulled in so fix that by explicitly defining it.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoMAINTAINERS: add RaspberryPi co-maintainer
Matthias Brugger [Wed, 30 Nov 2022 11:57:49 +0000 (12:57 +0100)]
MAINTAINERS: add RaspberryPi co-maintainer

Peter accpeted to step up as a co-maintainer for the RPis.
Reflect that in the corresponding MAINTAINERS files.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
19 months agoMerge branch '2022-11-28-networking-updates-and-improvements'
Tom Rini [Mon, 28 Nov 2022 18:12:40 +0000 (13:12 -0500)]
Merge branch '2022-11-28-networking-updates-and-improvements'

- LiteX Ethernet support, dwc_eth_qos fixes, re-work fixing
  CVE-2022-{30790,30552}, macb race fix, Intel XWAY PHY support
  and add wget command and TCP support.

19 months agophy: add driver for Intel XWAY PHY
Tim Harvey [Thu, 17 Nov 2022 21:27:09 +0000 (13:27 -0800)]
phy: add driver for Intel XWAY PHY

Add a driver for the Intel XWAY GbE PHY:
 - configure RGMII using dt phy-mode and standard delay properties
 - use genphy_config

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
19 months agonet: macb: Fix race caused by flushing unwanted descriptors
Yaron Micher [Thu, 10 Nov 2022 17:31:34 +0000 (19:31 +0200)]
net: macb: Fix race caused by flushing unwanted descriptors

The rx descriptor list is in cached memory, and there may be multiple
descriptors per cache-line. After reclaim_rx_buffers marks a descriptor
as unused it does a cache flush, which causes the entire cache-line to
be written to memory, which may override other descriptors in the same
cache-line that the controller may have written to.

The fix skips freeing descriptors that are not the last in a cache-line,
and if the freed descriptor is the last one in a cache-line, it marks
all the descriptors in the cache-line as unused.
This is similarly to what is done in drivers/net/fec_mxc.c

In my case this bug caused tftpboot to fail some times when other
packets are sent to u-boot in addition to the ongoing tftp (e.g. ping).
The driver would stop receiving new packets because it is waiting
on a descriptor that is marked unused, when in reality the descriptor
contains a new unprocessed packet but while freeing the previous buffer
descriptor & flushing the cache, the driver accidentally marked the
descriptor as unused.

Signed-off-by: Yaron Micher <yaronm@hailo.ai>
19 months agotest: cmd: add test for wget command.
Ying-Chun Liu (PaulLiu) [Tue, 8 Nov 2022 06:17:31 +0000 (14:17 +0800)]
test: cmd: add test for wget command.

Simulate a TCP HTTP server's response for testing wget command.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
19 months agodoc: cmd: wget: add documentation
Ying-Chun Liu (PaulLiu) [Tue, 8 Nov 2022 06:17:30 +0000 (14:17 +0800)]
doc: cmd: wget: add documentation

Add documentation for the wget command.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
19 months agonet: Add wget application
Ying-Chun Liu (PaulLiu) [Tue, 8 Nov 2022 06:17:29 +0000 (14:17 +0800)]
net: Add wget application

This commit adds a simple wget command that can download files
from http server.

The command syntax is
wget ${loadaddr} <path of the file from server>

Signed-off-by: Duncan Hare <DuncanCHare@yahoo.com>
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
19 months agonet: Add TCP protocol
Ying-Chun Liu (PaulLiu) [Tue, 8 Nov 2022 06:17:28 +0000 (14:17 +0800)]
net: Add TCP protocol

Currently file transfers are done using tftp or NFS both
over udp. This requires a request to be sent from client
(u-boot) to the boot server.

The current standard is TCP with selective acknowledgment.

Signed-off-by: Duncan Hare <DH@Synoia.com>
Signed-off-by: Duncan Hare <DuncanCHare@yahoo.com>
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
19 months agodrivers: net: aquantia: fix typos
Tim Harvey [Thu, 3 Nov 2022 21:44:22 +0000 (14:44 -0700)]
drivers: net: aquantia: fix typos

Fix a couple of typos:
- s/Acquantia/Aquantia/
- s/firmare/firmware/

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
19 months agonet: deal with fragment-overlapping-two-holes case
Rasmus Villemoes [Mon, 17 Oct 2022 07:52:51 +0000 (09:52 +0200)]
net: deal with fragment-overlapping-two-holes case

With a suitable sequence of malicious packets, it's currently possible
to get a hole descriptor to contain arbitrary attacker-controlled
contents, and then with one more packet to use that as an arbitrary
write vector.

While one could possibly change the algorithm so we instead loop over
all holes, and in each hole puts as much of the current fragment as
belongs there (taking care to carefully update the hole list as
appropriate), it's not worth the complexity: In real, non-malicious
scenarios, one never gets overlapping fragments, and certainly not
fragments that would be supersets of one another.

So instead opt for this simple protection: Simply don't allow the
eventual memcpy() to write beyond the last_byte of the current hole.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
19 months agonet: tftp: sanitize tftp block size, especially for TX
Rasmus Villemoes [Fri, 14 Oct 2022 17:43:42 +0000 (19:43 +0200)]
net: tftp: sanitize tftp block size, especially for TX

U-Boot does not support IP fragmentation on TX (and unless
CONFIG_IP_DEFRAG is set, neither on RX). So the blocks we send must
fit in a single ethernet packet.

Currently, if tftpblocksize is set to something like 5000 and I
tftpput a large enough file, U-Boot crashes because we overflow
net_tx_packet (which only has room for 1500 bytes plus change).

Similarly, if tftpblocksize is set to something larger than what we
can actually receive (e.g. 50000, with NET_MAXDEFRAG being 16384), any
tftp get just hangs because we never receive any packets.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
19 months agonet: tftp: use IS_ENABLED(CONFIG_NET_TFTP_VARS) instead of #if
Rasmus Villemoes [Fri, 14 Oct 2022 17:43:41 +0000 (19:43 +0200)]
net: tftp: use IS_ENABLED(CONFIG_NET_TFTP_VARS) instead of #if

Nothing inside this block depends on NET_TFTP_VARS to be set to parse
correctly. Switch to C if() in preparation for adding code before
this (to avoid a declaration-after-statement warning).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
[trini: Update to cover CONFIG_TFTP_PORT case as well]
Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agonet: fix ip_len in reassembled IP datagram
Rasmus Villemoes [Fri, 14 Oct 2022 17:43:40 +0000 (19:43 +0200)]
net: fix ip_len in reassembled IP datagram

For some reason, the ip_len field in a reassembled IP datagram is set
to just the size of the payload, but it should be set to the value it
would have had if the datagram had never been fragmented in the first
place, i.e. size of payload plus size of IP header.

That latter value is currently returned correctly via the "len"
variable. And before entering net_defragment(), len does have the
value ntohs(ip->ip_len), so if we're not dealing with a
fragment (so net_defragment leaves *len alone), that relationship of
course also holds after the net_defragment() call.

The only use I can find of ip->ip_len after the net_defragment call is
the ntohs(ip->udp_len) > ntohs(ip->ip_len) sanity check - none of the
functions that are passed the "ip" pointer themselves inspect ->ip_len
but instead use the passed len.

But that sanity check is a bit odd, since the RHS really should be
"ntohs(ip->ip_len) - 20", i.e. the IP payload size.

Now that we've fixed things so that len == ntohs(ip->ip_len) in all
cases, change that sanity check to use len-20 as the RHS.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
19 months agonet: (actually/better) deal with CVE-2022-{30790,30552}
Rasmus Villemoes [Fri, 14 Oct 2022 17:43:39 +0000 (19:43 +0200)]
net: (actually/better) deal with CVE-2022-{30790,30552}

I hit a strange problem with v2022.10: Sometimes my tftp transfer
would seemingly just hang. It only happened for some files. Moreover,
changing tftpblocksize from 65464 to 65460 or 65000 made it work again
for all the files I tried. So I started suspecting it had something to
do with the file sizes and in particular the way the tftp blocks get
fragmented and reassembled.

v2022.01 showed no problems with any of the files or any value of
tftpblocksize.

Looking at what had changed in net.c or tftp.c since January showed
only one remotely interesting thing, b85d130ea0ca.

So I fired up wireshark on my host to see if somehow one of the
packets would be too small. But no, with both v2022.01 and v2022.10,
the exact same sequence of packets were sent, all but the last of size
1500, and the last being 1280 bytes.

But then it struck me that 1280 is 5*256, so one of the two bytes
on-the-wire is 0 and the other is 5, and when then looking at the code
again the lack of endianness conversion becomes obvious. [ntohs is
both applied to ip->ip_off just above, as well as to ip->ip_len just a
little further down when the "len" is actually computed].

IOWs the current code would falsely reject any packet which happens to
be a multiple of 256 bytes in size, breaking tftp transfers somewhat
randomly, and if it did get one of those "malicious" packets with
ip_len set to, say, 27, it would be seen by this check as being 6912
and hence not rejected.

====

Now, just adding the missing ntohs() would make my initial problem go
away, in that I can now download the file where the last fragment ends
up being 1280 bytes. But there's another bug in the code and/or
analysis: The right-hand side is too strict, in that it is ok for the
last fragment not to have a multiple of 8 bytes as payload - it really
must be ok, because nothing in the IP spec says that IP datagrams must
have a multiple of 8 bytes as payload. And comments in the code also
mention this.

To fix that, replace the comparison with <= IP_HDR_SIZE and add
another check that len is actually a multiple of 8 when the "more
fragments" bit is set - which it necessarily is for the case where
offset8 ends up being 0, since we're only called when

  (ip_off & (IP_OFFS | IP_FLAGS_MFRAG)).

====

So, does this fix CVE-2022-30790 for real? It certainly correctly
rejects the POC code which relies on sending a packet of size 27 with
the MFRAG flag set. Can the attack be carried out with a size 27
packet that doesn't set MFRAG (hence must set a non-zero fragment
offset)? I dunno. If we get a packet without MFRAG, we update
h->last_byte in the hole we've found to be start+len, hence we'd enter
one of

if ((h >= thisfrag) && (h->last_byte <= start + len)) {

or

} else if (h->last_byte <= start + len) {

and thus won't reach any of the

/* overlaps with initial part of the hole: move this hole */
newh = thisfrag + (len / 8);

/* fragment sits in the middle: split the hole */
newh = thisfrag + (len / 8);

IOW these division are now guaranteed to be exact, and thus I think
the scenario in CVE-2022-30790 cannot happen anymore.

====

However, there's a big elephant in the room, which has always been
spelled out in the comments, and which makes me believe that one can
still cause mayhem even with packets whose payloads are all 8-byte
aligned:

    This code doesn't deal with a fragment that overlaps with two
    different holes (thus being a superset of a previously-received
    fragment).

Suppose each character below represents 8 bytes, with D being already
received data, H being a hole descriptor (struct hole), h being
non-populated chunks, and P representing where the payload of a just
received packet should go:

  DDDHhhhhDDDDHhhhDDDD
        PPPPPPPPP

I'm pretty sure in this case we'd end up with h being the first hole,
enter the simple

} else if (h->last_byte <= start + len) {
/* overlaps with final part of the hole: shorten this hole */
h->last_byte = start;

case, and thus in the memcpy happily overwrite the second H with our
chosen payload. This is probably worth fixing...

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
19 months agonet: compare received length to sizeof(ip_hdr), not sizeof(ip_udp_hdr)
Rasmus Villemoes [Fri, 14 Oct 2022 17:43:38 +0000 (19:43 +0200)]
net: compare received length to sizeof(ip_hdr), not sizeof(ip_udp_hdr)

While the code mostly/only handles UDP packets, it's possible for the
last fragment of a fragmented UDP packet to be smaller than 28 bytes;
it can be as small as 21 bytes (an IP header plus one byte of
payload). So until we've performed the defragmentation step and thus
know whether we're now holding a full packet, we should only check for
the existence of the fields in the ip header, i.e. that there are at
least 20 bytes present.

In practice, we always seem to be handed a "len" of minimum 60 from the
device layer, i.e. minimal ethernet frame length minus FCS, so this is
mostly theoretical.

After we've fetched the header's claimed length and used that to
update the len variable, check that the header itself claims to be the
minimal possible length.

This is probably how CVE-2022-30552 should have been dealt with in the
first place, because net_defragment() is not the only place that wants
to know the size of the IP datagram payload: If we receive a
non-fragmented ICMP packet, we pass "len" to receive_icmp() which in
turn may pass it to ping_receive() which does

  compute_ip_checksum(icmph, len - IP_HDR_SIZE)

and due to the signature of compute_ip_checksum(), that would then
lead to accessing ~4G of address space, very likely leading to a
crash.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
19 months agonet: improve check for no IP options
Rasmus Villemoes [Fri, 14 Oct 2022 17:43:37 +0000 (19:43 +0200)]
net: improve check for no IP options

There's no reason we should accept an IP packet with a malformed IHL
field. So ensure that it is exactly 5, not just <= 5.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
19 months agonet: dwc_eth_qos: Add support for bulk RX descriptor cleaning
Marek Vasut [Sun, 9 Oct 2022 15:51:46 +0000 (17:51 +0200)]
net: dwc_eth_qos: Add support for bulk RX descriptor cleaning

Add new desc_per_cacheline property which lets a platform run RX descriptor
cleanup after every power-of-2 - 1 received packets instead of every packet.
This is useful on platforms where (axi_bus_width EQOS_AXI_WIDTH_n * DMA DSL
inter-descriptor word skip count + DMA descriptor size) is less than cache
line size, which necessitates packing multiple DMA descriptors into single
cache line.

In case of TX descriptors, this is not a problem, since the driver always
does synchronous TX, i.e. the TX descriptor is always written, flushed and
polled for completion in eqos_send().

In case of RX descriptors, it is necessary to update their status in bulk,
i.e. after the entire cache line worth of RX descriptors has been used up
to receive data.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
19 months agonet: dwc_eth_qos: Split TX and RX DMA rings
Marek Vasut [Sun, 9 Oct 2022 15:51:45 +0000 (17:51 +0200)]
net: dwc_eth_qos: Split TX and RX DMA rings

Separate TX and RX DMA rings to make their handling slightly clearer.
This is a preparatory patch for bulk RX descriptor flushing.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
19 months agoliteeth: LiteX Ethernet device
Joel Stanley [Mon, 26 Sep 2022 06:05:58 +0000 (15:35 +0930)]
liteeth: LiteX Ethernet device

LiteX is a soft system-on-chip that targets FPGAs. LiteETH is a basic
network device that is commonly used in LiteX designs.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
19 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Mon, 28 Nov 2022 14:35:02 +0000 (09:35 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

- DWC3 fixes / improvements

19 months agousb: dwc3: Drop support for "snps, ref-clock-period-ns" DT property
Marek Vasut [Sun, 27 Nov 2022 14:31:56 +0000 (15:31 +0100)]
usb: dwc3: Drop support for "snps, ref-clock-period-ns" DT property

Drop support for quickly deprecated DT property "snps,ref-clock-period-ns"
to prevent its proliferation.

Reviewed-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
19 months agousb: dwc3: Program GFLADJ
Sean Anderson [Sun, 27 Nov 2022 14:31:55 +0000 (15:31 +0100)]
usb: dwc3: Program GFLADJ

GUCTL.REFCLKPER can only account for clock frequencies with integer
periods. To address this, program REFCLK_FLADJ with the relative error
caused by period truncation. The formula given in the register reference
has been rearranged to allow calculation based on rate (instead of
period), and to allow for fixed-point arithmetic.

Additionally, calculate a value for 240MHZDECR. This configures a
simulated 240Mhz clock using a counter with one fractional bit (PLS1).

This register is programmed only for versions >= 2.50a, since this is
the check also used by commit db2be4e9e30c ("usb: dwc3: Add frame length
adjustment quirk").

[ marek: Ported from Linux kernel commit
         596c87856e08d ("usb: dwc3: Program GFLADJ") ]

Reviewed-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Marek Vasut <marex@denx.de> # Port from Linux
19 months agousb: dwc3: Calculate REFCLKPER based on reference clock
Sean Anderson [Sun, 27 Nov 2022 14:31:54 +0000 (15:31 +0100)]
usb: dwc3: Calculate REFCLKPER based on reference clock

Instead of using a special property to determine the reference clock
period, use the rate of the reference clock. When we have a legacy
snps,ref-clock-period-ns property and no reference clock, use it
instead. Fractional clocks are not currently supported, and will be
dealt with in the next commit.

[ marek: Ported from Linux kernel commit
         5114c3ee24875 ("usb: dwc3: Calculate REFCLKPER based on reference clock") ]

Reviewed-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Marek Vasut <marex@denx.de> # Port from Linux
19 months agousb: dwc3: reference clock period configuration
Balaji Prakash J [Sun, 27 Nov 2022 14:31:53 +0000 (15:31 +0100)]
usb: dwc3: reference clock period configuration

Set reference clock period when it differs from dwc3 default hardware
set.

We could calculate clock period based on reference clock frequency. But
this information is not always available. This is the case of PCI bus
attached USB host. For that reason we use a custom property.

Tested (USB2 only) on IPQ6010 SoC based board with 24 MHz reference
clock while hardware default is 19.2 MHz.

[ baruch: rewrite commit message; drop GFLADJ code; remove 'quirk-' from
  property name; mention tested hardware ]

[ marek: Ported from Linux kernel commit
         7bee318838890 ("usb: dwc3: reference clock period configuration") ]

Reviewed-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Balaji Prakash J <bjagadee@codeaurora.org>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Marek Vasut <marex@denx.de> # Port from Linux
19 months agousb: dwc3: Cache ref_clk pointer in struct dwc3
Marek Vasut [Sun, 27 Nov 2022 14:31:52 +0000 (15:31 +0100)]
usb: dwc3: Cache ref_clk pointer in struct dwc3

Cache ref_clk clock pointer in struct dwc3 . This is a preparatory
patch for subsequent backports from Linux kernel which configure
GFLADJ register content based on the ref_clk rate and therefore need
access to the ref_clk pointer.

It is possible to extract the clock pointer from existing clk_bulk
list of already claimed clock, no need to call clk_get*() again.

Reviewed-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
19 months agousb: Expand buffer size in usb_find_and_bind_driver()
Marek Vasut [Sat, 26 Nov 2022 12:57:53 +0000 (13:57 +0100)]
usb: Expand buffer size in usb_find_and_bind_driver()

The "generic_bus_%x_dev_%x" string which is printed into this buffer
can be up to 34 characters long ("generic_bus_12345678_dev_12345678").
The buffer would be clipped by snprintf() if both %x were at maximum
range. Make sure the buffer is long enough to cover such possibility.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoMerge branch '2022-11-23-assorted-fixes'
Tom Rini [Thu, 24 Nov 2022 21:31:02 +0000 (16:31 -0500)]
Merge branch '2022-11-23-assorted-fixes'

- Small ubifs updates, mkenvimage fix, ast2600 ram updates, update CI to
  make git happier, spelling fix in K3 code and fix dependencies in
  CMD_CLS

19 months agocmd: fix dependency for CMD_CLS
John Keeping [Wed, 23 Nov 2022 17:16:14 +0000 (17:16 +0000)]
cmd: fix dependency for CMD_CLS

It seems this symbol was missed when renaming DM_VIDEO -> VIDEO.  Update
it.

Fixes: b86986c7b3 ("video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO")
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: John Keeping <john@metanate.com>
19 months agoarm: mach-k3: fix spelling mistake "entended" -> "extended"
Bryan Brattlof [Tue, 22 Nov 2022 19:28:11 +0000 (13:28 -0600)]
arm: mach-k3: fix spelling mistake "entended" -> "extended"

the macro for the boot data location from rom is misspelled. fix it

Signed-off-by: Bryan Brattlof <bb@ti.com>
19 months agoCI: Make more use of git safe.directory
Tom Rini [Mon, 21 Nov 2022 17:52:40 +0000 (12:52 -0500)]
CI: Make more use of git safe.directory

We have a number of jobs that will have git complain about needing to
set safe.directory and this being untrue as a fatal error, but then
complete. Set this flag correctly now as it should be used, and may
prevent a future failure.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoram: ast2600: Align the RL and WL setting
Dylan Hung [Fri, 11 Nov 2022 07:30:08 +0000 (15:30 +0800)]
ram: ast2600: Align the RL and WL setting

Use macro to represent the RL and WL setting to ensure the PHY and
controller setting are aligned.

Review-by: Ryan Chen <ryan_chen@aspeedtech.com>
Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
19 months agoram: ast2600: Improve ddr4 timing and signal quality
Dylan Hung [Fri, 11 Nov 2022 07:30:07 +0000 (15:30 +0800)]
ram: ast2600: Improve ddr4 timing and signal quality

Adjust the following settings to get better timing and signal quality.

1. write DQS/DQ delay
1e6e2304[0]
1e6e2304[15:8]

2. read DQS/DQ delay
- 0x1e6e0298[0]
- 0x1e6e0298[15:8]

3. CLK/CA timing
- 0x1e6e01a8[31]

4. Read and write termination
- change RTT_ROM from 40 ohm to 48 ohm (MR1[10:8])
- change RTT_PARK from disable to 48 ohm (MR5[8:6])
- change RTT_WR from 120 ohm to disable (MR2[11:9])
- change PHY ODT from 40 ohm to 80 ohm (0x1e6e0130[10:8])

Note1: Both DDR-PHY and DDR controller have their own registers for DDR4
Mode Registers (MR0~MR6).  This patch introduces macros to synchronize
the MR value on both sides.

Note2: the waveform meansurement can be found in item #21 of Aspeed
AST26x0 Application note (AP note).

Review-by: Ryan Chen <ryan_chen@aspeedtech.com>
Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
19 months agoram: ast2600: Fix incorrect statement of the register polling
Dylan Hung [Fri, 11 Nov 2022 07:30:06 +0000 (15:30 +0800)]
ram: ast2600: Fix incorrect statement of the register polling

The condition "~data" in the if-statement is a typo.  The original
intention is to poll if SDRAM_PHYCTRL0_INIT bit equals to 0. So use
"data == 0" for instead.

Besides, the bit[1] of "phy_status" register is hardwired to
SDRAM_PHYCTRL0_INIT (with inverse logic). Since SDRAM_PHYCTRL0_INIT has
already done, remove the unnecessary checking of phy_status[1].

Fixes: fde93143469f ("ram: aspeed: Add AST2600 DRAM control support")
Review-by: Ryan Chen <ryan_chen@aspeedtech.com>
Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
19 months agotools: mkenvimage: Drop duplicate crc header include
Marek Vasut [Mon, 7 Nov 2022 00:56:04 +0000 (01:56 +0100)]
tools: mkenvimage: Drop duplicate crc header include

This header was already included just above version.h,
do not include it twice.

Fixes: 3db71108575 ("crc32: Use the crc.h header for crc functions")
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agocmd: ubifs: Do not show usage when command fails
Pali Rohár [Sun, 7 Aug 2022 19:58:56 +0000 (21:58 +0200)]
cmd: ubifs: Do not show usage when command fails

Return value -1 cause U-Boot to print usage message. Return value
1 (CMD_RET_FAILURE) indicates failure. So fix return value when ubifs
command starts it execution and fails.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
19 months agoubifs: Allow to silence debug dumps
Pali Rohár [Sun, 7 Aug 2022 19:27:09 +0000 (21:27 +0200)]
ubifs: Allow to silence debug dumps

Debug dump logs are not always required. Add a new config option
UBIFS_SILENCE_DEBUG_DUMP to silence all debug dumps. On powerpc/mpc85xx
when enabled this will decrease size of U-Boot binary by 11 kB.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
19 months agoMerge tag 'u-boot-amlogic-20221122' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Wed, 23 Nov 2022 15:05:26 +0000 (10:05 -0500)]
Merge tag 'u-boot-amlogic-20221122' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- Implement setbrg op to meson serial device
- Re-add the old PHY reset binding for nanopi-k2

19 months agoMerge tag 'dm-pull-22nov22' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Wed, 23 Nov 2022 03:14:06 +0000 (22:14 -0500)]
Merge tag 'dm-pull-22nov22' of https://source.denx.de/u-boot/custodians/u-boot-dm

buildman /binman improvements for handling missing blobs
fix for long-standing image.h warning
minor fixes

19 months agotest: Disable part of the setexpr test for now
Simon Glass [Tue, 22 Nov 2022 22:12:10 +0000 (15:12 -0700)]
test: Disable part of the setexpr test for now

This fails in CI for unknown reasons. Disable the last assert for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agotest: cmd: fdt: Add fdt get value test case
Marek Vasut [Mon, 14 Nov 2022 21:50:00 +0000 (22:50 +0100)]
test: cmd: fdt: Add fdt get value test case

Add test case for 'fdt get value' sub command.

The test case can be triggered using:
"
./u-boot -d u-boot.dtb -c 'ut fdt'
"

Acked-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Marek Vasut <marex@denx.de>
19 months agocmd: fdt: Fix iteration over elements above index 1 in fdt get
Marek Vasut [Mon, 14 Nov 2022 21:49:59 +0000 (22:49 +0100)]
cmd: fdt: Fix iteration over elements above index 1 in fdt get

Always increment both the iterator and pointer into the string
property value by length of the current element + 1 (to cater
for the string delimiter), otherwise the element extracted from
the string property value would be extracted from an offset that
is multiple of the length of the first element, instead of sum
of element lengths until select index.

This fixes 'fdt get value' operation for index above 1 (counting
from index 0).

Acked-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fixes: 13982ced2cc ("cmd: fdt: Add support for reading stringlist property values")
Signed-off-by: Marek Vasut <marex@denx.de>
19 months agosandbox: Move the capsule GUID declarations to board file
Sughosh Ganu [Thu, 10 Nov 2022 17:04:30 +0000 (22:34 +0530)]
sandbox: Move the capsule GUID declarations to board file

The sandbox config file is to be removed. Move the GUID declarations
needed for capsule update functionality to the board file where they
are used.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agosandbox: check lseek return value in handle_ufi_command
Heinrich Schuchardt [Thu, 10 Nov 2022 07:40:30 +0000 (08:40 +0100)]
sandbox: check lseek return value in handle_ufi_command

Invoking lseek() may result in an error. Handle it.

Addresses-Coverity-ID: 376212 ("Error handling issues  (CHECKED_RETURN)")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
19 months agobinman: Add documentation for the command line args
Simon Glass [Thu, 10 Nov 2022 02:14:54 +0000 (19:14 -0700)]
binman: Add documentation for the command line args

Add command-line documentation for binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobuildman: Add --allow-missing flag to allow missing blobs
Tom Rini [Thu, 10 Nov 2022 02:14:53 +0000 (19:14 -0700)]
buildman: Add --allow-missing flag to allow missing blobs

Add a new flag to buildman so that we will in turn pass
BINMAN_ALLOW_MISSING=1 to 'make'. Make use of this flag in CI.

Allow the settings file to control this.

Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobuildman: Reinstate removal of temp output dir in tests
Simon Glass [Thu, 10 Nov 2022 02:14:52 +0000 (19:14 -0700)]
buildman: Reinstate removal of temp output dir in tests

This was dropped my mistake. Reinstate it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: d829f1217c6 ("bulidman: Add support for a simple build")

19 months agobuildman: Ensure config_fname is inited
Simon Glass [Thu, 10 Nov 2022 02:14:51 +0000 (19:14 -0700)]
buildman: Ensure config_fname is inited

Init this variable at the top level since it is a global.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoglobal: Do not default to faking missing binaries for buildman
Tom Rini [Thu, 10 Nov 2022 02:14:50 +0000 (19:14 -0700)]
global: Do not default to faking missing binaries for buildman

While it is possible and documented on how to re-run buildman to replace
faked required binary files after the fact, this behavior ends up being
more confusing than helpful in practice. Switch to requiring
BINMAN_ALLOW_MISSING=1 to be passed on the 'make' line to enable this
behavior.

Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobinman: Add a separate section about environment variables
Simon Glass [Thu, 10 Nov 2022 02:14:49 +0000 (19:14 -0700)]
binman: Add a separate section about environment variables

These are documented in various several sections. Add a new section that
mentions them all in one place so it is easier to see what environment
variables can be used to control U-Boot's use of binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
19 months agobuildman: Detect binman reporting missing blobs
Simon Glass [Thu, 10 Nov 2022 02:14:48 +0000 (19:14 -0700)]
buildman: Detect binman reporting missing blobs

Buildman should consider a build as a success (with warnings) if missing
blobs have been dealt with by binman, even though buildman itself returns
and error code overall. This is how other warnings are dealt with.

We cannot easily access the 103 exit code, so detect the problem in the
output.

With this change, missing blobs result in an exit code of 101, although
they still indicate failure.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobuildman: Drop mention of old architectures
Simon Glass [Thu, 10 Nov 2022 02:14:47 +0000 (19:14 -0700)]
buildman: Drop mention of old architectures

Support for some architectures has been removed since buildman was first
written. Also all toolchains are now available at kernel.org so we don't
need the links, except for arc where the kernel.org toolchain fails to
build all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobuildman: Update the default settings file
Simon Glass [Thu, 10 Nov 2022 02:14:46 +0000 (19:14 -0700)]
buildman: Update the default settings file

The settings file omits a few lines which are useful for getting every
board building. Add these and update the documentation tool.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobuildman: Update the arc toolchain
Simon Glass [Thu, 10 Nov 2022 02:14:45 +0000 (19:14 -0700)]
buildman: Update the arc toolchain

There is one on kernel.org but it does not build the hsdk_4xd board. Add
a link to one which does.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobuildman: Drop mention of MAKEALL
Simon Glass [Thu, 10 Nov 2022 02:14:44 +0000 (19:14 -0700)]
buildman: Drop mention of MAKEALL

This script was removed about 6 years ago so most people should be aware
that it is not needed anymore. Drop mention of it.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobuildman: Convert documentation to rST
Simon Glass [Thu, 10 Nov 2022 02:14:43 +0000 (19:14 -0700)]
buildman: Convert documentation to rST

Convert the buildman documentation to rST format and include it in the
'build' section.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <foss+uboot@0leil.net>
19 months agobinman: Use an exit code when blobs are missing
Simon Glass [Thu, 10 Nov 2022 02:14:42 +0000 (19:14 -0700)]
binman: Use an exit code when blobs are missing

At present binman returns success when told to handle missing/faked blobs
or missing bintools. This is confusing since in fact the resulting image
cannot work.

Use exit code 103 to signal this problem, with a -W option to convert
it to a warning.

Rename the flag to --ignore-missing since it controls bintools also.

Add documentation about exit codes while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agodoc: Correct the path to the Makefile documentation
Simon Glass [Thu, 10 Nov 2022 02:14:41 +0000 (19:14 -0700)]
doc: Correct the path to the Makefile documentation

This is out-of-date now. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoMakefile: Correct the binman rule
Simon Glass [Thu, 10 Nov 2022 02:14:40 +0000 (19:14 -0700)]
Makefile: Correct the binman rule

This currently uses if_changed on a phony target. Use a real file as the
target and add FORCE at the end, as required. Drop the 'inputs' phony
since it is not needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoimage: Correct strncpy() warning with image_set_name()
Simon Glass [Thu, 10 Nov 2022 02:14:39 +0000 (19:14 -0700)]
image: Correct strncpy() warning with image_set_name()

gcc 12 seems to warn on strncpy() as a matter of course. Rewrite the code
a different way to do the same thing, to avoid the warning.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoRevert "binman: btool: gzip: fix packer name so that binary can be found"
Quentin Schulz [Mon, 7 Nov 2022 12:54:56 +0000 (13:54 +0100)]
Revert "binman: btool: gzip: fix packer name so that binary can be found"

This reverts commit daa2da754afe1bac777f6cb0f05233e0de7b325d.

This commit is not needed anymore since the btool_ prefix is
automatically stripped by bintool.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agobinman: bintool: remove btool_ prefix from btool names
Quentin Schulz [Mon, 7 Nov 2022 12:54:54 +0000 (13:54 +0100)]
binman: bintool: remove btool_ prefix from btool names

The binary is looked on the system by the suffix of the packer class.
This means binman was looking for btool_gzip on the system and not gzip.

Since a btool can have its btool_ prefix missing but its module and
binary presence on the system appropriately found, there's no need to
actually keep this prefix after listing all possible btools, so let's
remove it.

This fixes gzip btool by letting Bintool.find_bintool_class handle the
missing prefix and still return the correct class which is then init
with gzip name instead of btool_gzip.

Additionally, there was an issue with the cached module global variable.
The variable only stores the module and not the associated class name
when calling find_bintool_class.
This means that when caching the module on the first call to
find_bintool_class, class_name would be set to Bintoolbtool_gzip but the
module_name gzip only, adding the module in the gzip key in the module
dictionary. When hitting the cache on next calls, the gzip key would be
found, so its value (the module) is used. However the default class_name
(Bintoolgzip) is used, failing the getattr call.

Instead, let's enforce the same class name: Bintool<packer>, whatever
the filename it is contained in.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoarm64: dts: meson: nanopi-k2: readd PHY reset properties
Christian Hewitt [Tue, 25 Oct 2022 14:32:05 +0000 (14:32 +0000)]
arm64: dts: meson: nanopi-k2: readd PHY reset properties

The sync of device-tree/bindings in 11a48a5a18c6 ("Linux 5.6-rc2") causes
Ethernet to break on some GXBB boards; the PHY seems to need proper reset
timing to function in u-boot and Linux. Re-add the old PHY reset binding
for dwmac until we support new bindings in the PHY node. This borrows the
same fix applied to the Odroid C2 board [0].

[0] https://lists.denx.de/pipermail/u-boot/2021-April/446658.html

Fixes: dd5f2351e99a ("arm64: dts: meson: sync dt and bindings from v5.6-rc2")
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
Link: https://lore.kernel.org/r/20221025143205.14470-1-christianshewitt@gmail.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
19 months agoarm: amlogic: add setbrg op to serial device
Edoardo Tomelleri [Sun, 18 Sep 2022 16:17:01 +0000 (18:17 +0200)]
arm: amlogic: add setbrg op to serial device

Implement setbrg in amlogic/meson serial device with driver model
similar to how the meson_uart.c driver does it in Linux. Also
configure (probe) the serial device with the new reg5 register.

Signed-off-by: Edoardo Tomelleri <e.tomell@gmail.com>
Link: https://lore.kernel.org/r/20220918161701.572814-1-e.tomell@gmail.com
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
19 months agoMerge tag 'xilinx-for-v2023.01-rc3' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Tue, 22 Nov 2022 17:33:48 +0000 (12:33 -0500)]
Merge tag 'xilinx-for-v2023.01-rc3' of https://source.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2023.01-rc3

microblaze:
- Enable 32 bit addressing mode for SPIs

zynq:
- Minor DT fixes (PL clock enabling)

zynqmp:
- Disable watchdog by default
- Remove unused xlnx,eeprom chosen support
- Add missing symlink for vck190 SC revB
- Use mdio bus with ethernet-phy-id description

versal:
- Add mini qspi/ospi configuration

versal-net:
- Add soc driver
- Fix Kconfig entry for SOC
- Fix loading address location for MINI configuration
- Disable LMB for mini configuration

net:
- Fix ethernet-phy-id usage in the code

pinctrl:
- Revert high impedance/output enable support

timer:
- Fix timer relocation for Microblaze
- Fix timer wrap in 32bit Xilinx timer driver

19 months agoarm64: versal: Add octal spi flash mini u-boot configuration
Ashok Reddy Soma [Wed, 16 Nov 2022 14:11:55 +0000 (07:11 -0700)]
arm64: versal: Add octal spi flash mini u-boot configuration

Add configuration file for mini u-boot configuration which runs on a
smaller footprint from on chip memory(OCM). This configuration has
required CONFIG's enabled to support octal spi flash and uses DCC terminal
for console output. Add required dts for octal spi flash mini u-boot
configuration.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20221116141155.14788-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
19 months agospi: cadence-qspi: Fix compilation error in mini u-boot flash reset
Ashok Reddy Soma [Wed, 16 Nov 2022 14:11:54 +0000 (07:11 -0700)]
spi: cadence-qspi: Fix compilation error in mini u-boot flash reset

When cadence_qspi_versal_flash_reset() function is called in mini
u-boot where there is no firmware support, it is missing defines for
macro's BOOT_MODE_POR_0 & BOOT_MODE_POR_1. Remove them and replace with
already define macro's which have same values as these.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20221116141155.14788-3-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
19 months agoarm64: versal: Add qspi flash mini u-boot configuration
Ashok Reddy Soma [Wed, 16 Nov 2022 14:11:53 +0000 (07:11 -0700)]
arm64: versal: Add qspi flash mini u-boot configuration

Add configuration file for mini u-boot configuration which runs on a
smaller footprint from on chip memory(OCM). This configuration has
required CONFIG's enabled to support qspi flash and uses DCC terminal
for console output. Add required dts files for qspi mini configuration.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20221116141155.14788-2-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
19 months agoqspi: versal-net: Add condition for tapdelay register
Ashok Reddy Soma [Wed, 16 Nov 2022 15:40:30 +0000 (16:40 +0100)]
qspi: versal-net: Add condition for tapdelay register

Add CONFIG_ARCH_VERSAL_NET to select tapdelay register for versal-net.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/2500dd688214e2ec2d54ed3fabbfee0b1ca861a6.1668613229.git.michal.simek@amd.com
19 months agosoc: xilinx: versal-net: Add soc_xilinx_versal_net driver
Michal Simek [Wed, 16 Nov 2022 15:36:35 +0000 (16:36 +0100)]
soc: xilinx: versal-net: Add soc_xilinx_versal_net driver

Add soc_xilinx_versal_net driver to identify the family & revision of
versal-net SoC. Add Kconfig option CONFIG_SOC_XILINX_VERSAL_NET to
enable/disable this driver. To enable this driver by default, add this
config to xilinx_versal_net_virt_defconfig file. This driver will be
probed using platdata U_BOOT_DEVICE structure which is specified in
mach-versal-net/cpu.c.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/613d6bcffd9070f62cf348079ed16c120f8fc56f.1668612993.git.michal.simek@amd.com
19 months agoxilinx: versal-net: Disable LMB for mini configuration
Michal Simek [Wed, 16 Nov 2022 15:33:17 +0000 (16:33 +0100)]
xilinx: versal-net: Disable LMB for mini configuration

There is no reason to have LMB enabled on mini configuration because it is
only consuming space that's why disable it.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/47067c87b6b2e7600d3c2808e7d0aa6fe82aa1fe.1668612795.git.michal.simek@amd.com
19 months agoarm64: zynqmp: Describe TI phy as ethernet-phy-id with reset on zcu106
Michal Simek [Wed, 16 Nov 2022 10:59:19 +0000 (11:59 +0100)]
arm64: zynqmp: Describe TI phy as ethernet-phy-id with reset on zcu106

zcu106 also connects ethernet phy reset via tca6416 chip as is done on
other evaluation boards. That's why describe this connection to make sure
that ethernet phy is reset before it's use.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/21ccd672b799b5858021f6059098a1247c311fae.1668596358.git.michal.simek@amd.com
19 months agoxilinx: versal-net: Fix SYS_LOAD_ADDR to point to OCM
Michal Simek [Sun, 6 Nov 2022 19:48:06 +0000 (11:48 -0800)]
xilinx: versal-net: Fix SYS_LOAD_ADDR to point to OCM

Versal NET mini U-Boot configuration is used for memory testing that's why
load address can't be really placed in memory which doesn't need to work
that's why move it to start of OCM which is the same memory which U-Boot is
running from.

Signed-off-by: Michal Simek <michal.simek@amd.com>
19 months agoxilinx: versal-net: Fix incorrect platform name in Kconfig
Michal Simek [Sun, 6 Nov 2022 01:21:27 +0000 (18:21 -0700)]
xilinx: versal-net: Fix incorrect platform name in Kconfig

Fix incorrect name used in entry description.

Signed-off-by: Michal Simek <michal.simek@amd.com>
19 months agoarm64: zynqmp: Create vck190 spl link for revB
Michal Simek [Wed, 26 Oct 2022 07:38:00 +0000 (09:38 +0200)]
arm64: zynqmp: Create vck190 spl link for revB

vck190 system controller low level setup is the same for revB that's why
also create symlink to revA.

Signed-off-by: Michal Simek <michal.simek@amd.com>
19 months agonet: phy: Fix ethernet-phy-id <dot> in the code
Michal Simek [Tue, 1 Nov 2022 00:08:44 +0000 (17:08 -0700)]
net: phy: Fix ethernet-phy-id <dot> in the code

Use dot instead of comma. The fix doesn't affect anything but it is good to
be aligned with used pattern. The first is used only for string size
calculation and the second change is in the comment.

Fixes: db681d4929ca ("net: phy: Add new read ethernet phy id function")
Signed-off-by: Michal Simek <michal.simek@amd.com>
19 months agoARM: zynq: DT: Enable all FCLKs by default
Christian Kohn [Wed, 12 Oct 2022 09:30:33 +0000 (11:30 +0200)]
ARM: zynq: DT: Enable all FCLKs by default

The fclk-enable property is set to 0 which disables all FCLKs.
Enable all FCLKs so they can be used as clock sources in the
programmable logic.

Signed-off-by: Christian Kohn <christian.kohn@xilinx.com>
Acked-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/b1308dc1f14f8eb24662019f7376c959e5e763b8.1665567031.git.michal.simek@amd.com
19 months agotimer: xilinx-timer: use timer_conv_64() to fix timer wrap around
Ovidiu Panait [Wed, 12 Oct 2022 05:36:56 +0000 (08:36 +0300)]
timer: xilinx-timer: use timer_conv_64() to fix timer wrap around

Current xilinx_timer_get_count() implementation does not take into account
the periodic 32-bit wrap arounds, as it directly returns the 32-bit counter
register value. The roll-overs cause problems in the upper timer layers, as
generic timer code expects an incrementing 64-bit value from get_count() to
work correctly.

Add the missing 64-bit up-conversion to fix random hangs/delays in
__udelay().

Fixes: a36d86720f ("microblaze: Convert axi timer to DM driver")
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221012053656.1492457-3-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
19 months agotimer-uclass: relocate ops pointers for CONFIG_NEEDS_MANUAL_RELOC
Ovidiu Panait [Wed, 12 Oct 2022 05:36:55 +0000 (08:36 +0300)]
timer-uclass: relocate ops pointers for CONFIG_NEEDS_MANUAL_RELOC

Relocate timer_ops pointers when CONFIG_NEEDS_MANUAL_RELOC is enabled.

The (gd->flags & GD_FLG_RELOC) check was added to make sure the reloc_done
logic works for drivers that use DM_FLAG_PRE_RELOC.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20221012053656.1492457-2-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
19 months agotimer-uclass: add timer_get_ops() macro
Ovidiu Panait [Wed, 12 Oct 2022 05:36:54 +0000 (08:36 +0300)]
timer-uclass: add timer_get_ops() macro

Align timer uclass with the other subsystems and provide a timer_get_ops()
convenience macro.

Using this instead of the generic device_get_ops() also prevents
-Wdiscarded-qualifiers warnings when used with non-const variables.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20221012053656.1492457-1-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
19 months agoxilinx: common: Remove zynq_board_read_rom_ethaddr()
Venkatesh Yadav Abbarapu [Mon, 17 Oct 2022 09:48:18 +0000 (15:18 +0530)]
xilinx: common: Remove zynq_board_read_rom_ethaddr()

Removing the zynq_board_read_rom_ethaddr() function as
xlnx,eeprom is not used anymore. As all board dts to use
nvmem alias instead of xlnx,eeprom.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20221017094818.17996-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
19 months agoRevert "pinctrl: zynqmp: Add support for output-enable and bias-high-impedance"
Michal Simek [Thu, 13 Oct 2022 11:05:39 +0000 (13:05 +0200)]
Revert "pinctrl: zynqmp: Add support for output-enable and bias-high-impedance"

This reverts commit 123462e5e534d6e17b1b7d2006734bbe54b03e0a.

On systems with older PMUFW using these pinctrl properties can cause system
hang because there is missing feature autodetection.
When it is implemented support for these two properties should go back.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c2900319ea80484f21692997f296269aee701c1f.1665659138.git.michal.simek@amd.com
19 months agoarm64: zynqmp: Disable watchdog by default for virt platform
Michal Simek [Wed, 12 Oct 2022 09:35:30 +0000 (11:35 +0200)]
arm64: zynqmp: Disable watchdog by default for virt platform

Disable watchdog based on request in past that not all Linux rootfs have
proper utilities ready to service it. Enable it if your rootfs have proper
watchdog handling.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/62dfc08f32635abee42feab26aaa9efed52134c0.1665567328.git.michal.simek@amd.com
19 months agomicroblaze: Make extended addressing support default
T Karthik Reddy [Wed, 12 Oct 2022 09:03:45 +0000 (11:03 +0200)]
microblaze: Make extended addressing support default

Axi qspi controller supports 32-bit & 24-bit addressing modes
for micron, macronix & spansion flash parts. But for winbond
flashes it only supports 24-bit addressing mode.
Enable CONFIG_SPI_FLASH_BAR to use extended addressing mode
to make 32-bit addressing mode work on all flashes.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Acked-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/f3864966c8ddd766a1702ad61b0e008a1f57462f.1665565423.git.michal.simek@amd.com
19 months agoMerge tag 'efi-2023-01-rc2-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Tue, 22 Nov 2022 13:30:53 +0000 (08:30 -0500)]
Merge tag 'efi-2023-01-rc2-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-01-rc2-2

UEFI:

* add UEFI Secure Boot Key enrollment interface to eficonfig command
* fix buffer underflow in FatToStr() implementation

19 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-watchdog
Tom Rini [Tue, 22 Nov 2022 13:07:03 +0000 (08:07 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-watchdog

- watchdog: designware: make reset really optional (Quentin)
- watchdog: Drop GD_FLG_WDT_READY (Stefan)