platform/kernel/u-boot.git
3 years agoMerge tag 'dm-pull-3mar21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Thu, 4 Mar 2021 03:53:53 +0000 (22:53 -0500)]
Merge tag 'dm-pull-3mar21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

dm: Fix an obscure bug with empty of-platdata
Fixes for ns16550 base address and frequency-reading
Other minor fixes

3 years agoserial: ns16550: Handle zero <clock-frequency> value
Bin Meng [Wed, 3 Feb 2021 14:42:25 +0000 (22:42 +0800)]
serial: ns16550: Handle zero <clock-frequency> value

A working device tree node of ns16550 should never be populated
with value zero for the <clock-frequency> property. Unfortunately
this is the case for the QEMU ppce500 target.

Let's try to assign plat->clock to CONFIG_SYS_NS16550_CLK as the
last resort to handle such case.

This commit should be reverted when:

- The following QEMU patch [1] is merged, and
- U-Boot CI has upgraded its QEMU version that contains the fix

[1] http://patchwork.ozlabs.org/project/qemu-devel/patch/1612362288-22216-2-git-send-email-bmeng.cn@gmail.com/

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoserial: ns16550: Correct the base address type
Bin Meng [Wed, 3 Feb 2021 13:22:40 +0000 (21:22 +0800)]
serial: ns16550: Correct the base address type

Currently ns16550_serial_assign_base() treats the argument 'base'
with type `ulong`. This is incorrect because the base address was
obtained from device tree with type `fdt_addr_t` that can represent
a physical address larger than 32-bit in a 32-bit system.

Fixes: 9e6ce62190b7 ("serial: ns16550: Fix ordering of getting base address")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodts: Fix OF_LIVE dependency
Bin Meng [Wed, 3 Feb 2021 13:20:03 +0000 (21:20 +0800)]
dts: Fix OF_LIVE dependency

lib/of_live.c references the following 2 ofnode APIs:
of_alias_scan() and of_get_property().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib: Fix BINMAN_FDT dependency
Bin Meng [Wed, 3 Feb 2021 13:20:02 +0000 (21:20 +0800)]
lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: host bind must close file descriptor
Heinrich Schuchardt [Tue, 2 Feb 2021 23:21:56 +0000 (00:21 +0100)]
sandbox: host bind must close file descriptor

Each invocation of the 'host bind' command with a file name argument opens
a file descriptor. The next invocation of the 'host bind' command destroys
the block device but the file descriptor remains open. The same holds true
for the 'unbind blk' command.

Close the file descriptor when unbinding the host block device.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofix patman --limit-cc option
Bernhard Kirchen [Fri, 29 Jan 2021 14:10:08 +0000 (15:10 +0100)]
fix patman --limit-cc option

patman's --limit-cc option parses its argument to an integer and uses
that to trim the list of CC recipients to a particular maximum. but that
only works if the cc variable is a list, which it is not.

Signed-off-by: Bernhard Kirchen <bernhard.kirchen@mbconnectline.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agobootstage: Fix dependency for BOOTSTAGE_RECORD_COUNT
Simon Glass [Wed, 3 Feb 2021 13:00:49 +0000 (06:00 -0700)]
bootstage: Fix dependency for BOOTSTAGE_RECORD_COUNT

At present these three Kconfigs exist even when bootstage is not enabled.
This is not necessary since bootstage.c is only built if BOOTSTAGE is
enabled.

Make them conditional. Also fix up the overflow message to mention TPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add DM_DEVICE_REMOVE condition to all exit paths
Simon Glass [Thu, 4 Feb 2021 04:29:44 +0000 (21:29 -0700)]
dm: core: Add DM_DEVICE_REMOVE condition to all exit paths

At present device_bind() does some unnecessary work if a device fails to
bind in SPL. Add the missing conditions.

Also fix a style nit in the same function while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Fix allocation of empty of-platdata
Simon Glass [Thu, 4 Feb 2021 04:29:43 +0000 (21:29 -0700)]
dm: core: Fix allocation of empty of-platdata

With of-platdata we always have a dtv struct that holds the platform data
provided by the driver_info record. However, this struct can be empty if
there are no actual devicetree properties provided.

The upshot of empty platform data is that it will end up as a zero-size
member in the BSS section, which is fine. But if the driver specifies
plat_auto then it expects the correct amount of space to be allocated.

At present this does not happen, since device_bind() assumes that the
platform-data size will always be >0. As a result we end up not
allocating the space and just use the BSS region, overwriting whatever
other contents are present.

Fix this by removing the condition that platform data be non-empty, always
allocating space if requested.

This fixes a strange bug that has been lurking since of-platdata was
implemented. It has likely never been noticed since devices normally have
at least some devicetree properties, BSS is seldom used on SPL, the dtv
structs are normally at the end of bss and the overwriting only happens
if a driver changes its platform data.

It was discovered using sandbox_spl, which exercises more features than
a normal board might, and the critical global_data variable 'gd' happened
to be at the end of BSS.

Fixes: 9fa28190091 ("dm: core: Expand platdata for of-platdata devices")
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge tag 'u-boot-imx-20210303' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Wed, 3 Mar 2021 15:10:34 +0000 (10:10 -0500)]
Merge tag 'u-boot-imx-20210303' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

i.MX for 2021.04
----------------

- new boards:
- i.MX8MN Beacon EmbeddedWorks (2GB)
- Gateworks Venice imx8mm
- convert to DM:
- imx53-qsb, mx53loco, mx51evk, mx23-evk
- Fixes :
- Network : FEC ethernet quirks
- DH dh-imx6

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/6597

3 years agoboard: gateworks: imx8mm: Add Gateworks Venice board support
Tim Harvey [Tue, 2 Mar 2021 22:00:21 +0000 (14:00 -0800)]
board: gateworks: imx8mm: Add Gateworks Venice board support

Add initial support for Gateworks Venice product family based on the
i.MX 8M Mini SoC

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoarm: dts: imx8mm: add Gateworks i.MX8 Mini Dev kits
Tim Harvey [Tue, 2 Mar 2021 22:00:20 +0000 (14:00 -0800)]
arm: dts: imx8mm: add Gateworks i.MX8 Mini Dev kits

Add Gateworks i.MX 8M Mini Development kits from Linux-5.12-rc1

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Wed, 3 Mar 2021 12:54:55 +0000 (07:54 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

- Kconfig dependency fix for USB_KEYBOARD
- musb gadget fixes / enhancements

3 years agousb: USB keyboard requires DM_KEYBOARD
Heinrich Schuchardt [Sun, 28 Feb 2021 11:50:49 +0000 (12:50 +0100)]
usb: USB keyboard requires DM_KEYBOARD

If CONFIG_DM_USB=y, the USB keyboard only works if CONFIG_DM_KEYBOARD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoNokia RX-51: Enable usbtty serial console by default
Pali Rohár [Sat, 20 Feb 2021 10:50:15 +0000 (11:50 +0100)]
Nokia RX-51: Enable usbtty serial console by default

Now when usbtty serial console is fixed in U-Boot enable CONFIG_USB_TTY for
Nokia RX-51 board by default.

Fix also USB product id as U-Boot ignores CONFIG_USBD_PRODUCTID macro and
include U-Boot string into USB product name to indicate usage of U-Boot.

CONFIG_CONSOLE_MUX is already used and U-Boot console is available for
all in/out devices. Therefore there is no need to have separate commands
'run sercon', 'run usbcon' and 'run vgacon', so remove them.

As space for U-Boot is limited to 256kB, enable CONFIG_OPTIMIZE_INLINING
and disable some other unused options so CONFIG_USB_TTY can be enabled.

Nokia RX-51 does not have easily accessible UART serial console so the only
option for easy debugging is to use device's keyboard+screen or this usbtty
serial console over USB.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agoNokia RX-51: Move content of rx51.h to rx51.c
Pali Rohár [Sun, 7 Feb 2021 13:50:15 +0000 (14:50 +0100)]
Nokia RX-51: Move content of rx51.h to rx51.c

After removal of MUX configuration there is no need to have extra rx51.h.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agoNokia RX-51: Remove function set_muxconf_regs()
Pali Rohár [Sun, 7 Feb 2021 13:50:14 +0000 (14:50 +0100)]
Nokia RX-51: Remove function set_muxconf_regs()

This function is not used and was never called.

This board contains '#define CONFIG_SKIP_LOWLEVEL_INIT' because X-Loader
set everything up, including MUX configuration.

Also this MUX configuration is incorrect and does not match hardware.

So remove this dead, unused and broken code.

This change will decrease size of U-Boot binary.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agoarm: omap3: Compile s_init() function only when it is used
Pali Rohár [Sun, 7 Feb 2021 13:50:13 +0000 (14:50 +0100)]
arm: omap3: Compile s_init() function only when it is used

Function s_init() is called only from lowlevel_init(). So compile it only
when function lowlevel_init() is compiled.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agoarm: omap3: Compile lowlevel_init() function only when it is used
Pali Rohár [Sun, 7 Feb 2021 13:50:12 +0000 (14:50 +0100)]
arm: omap3: Compile lowlevel_init() function only when it is used

Function lowlevel_init() is called only from cpu_init_crit() and this
function is wrapped into #if .. #endif section. So compile also
lowlevel_init() function under same #if condition.

Function cpy_clk_code() uses lowlevel_init symbol to get address where
go_to_speed code ends. As this symbol is not available anymore when
compiling with CONFIG_SKIP_LOWLEVEL_INIT, defines a new label
go_to_speed_end at the place where go_to_speed code ends.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agousb: gadget: Use dbg_ep0() macro instead of serial_printf()
Pali Rohár [Sun, 7 Feb 2021 13:50:11 +0000 (14:50 +0100)]
usb: gadget: Use dbg_ep0() macro instead of serial_printf()

All debug messages from ep0.c except a few are printed by dbg_ep0() macro.
So for remaining few exceptions use also dbg_ep0() instead of serial_printf().

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agousb: musb: Ensure that we set musb dynamic FIFO buffer for every endpoint
Pali Rohár [Sun, 7 Feb 2021 13:50:10 +0000 (14:50 +0100)]
usb: musb: Ensure that we set musb dynamic FIFO buffer for every endpoint

If we do not set FIFO buffer address and size for some endpoint which is in
use then default programmed address 0x0 would be used which is in conflict
with address of FIFO buffer for endpoint 0. Moreover address of FIFO buffer
for endpoint 0 cannot be programmed, it is fixed to 0x0. Sharing address
space between more endpoints cause data loss and unexpected errors.

This patch is fixing transmission of characters over usbtty serial console
and allows using of usbtty for debugging purposes on Nokia N900.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agousb: musb: Fix handling interrupts for EP0 and SET ADDRESS commmand
Pali Rohár [Sun, 7 Feb 2021 13:50:09 +0000 (14:50 +0100)]
usb: musb: Fix handling interrupts for EP0 and SET ADDRESS commmand

Interrupt for EP0 is indicated in intrtx register via first bit. This bit
is set for both RX and TX despite register has only TX in its name. First
bit in intrrx register is reserved, not used and never set.

So remove calling musb_peri_ep0() function at every iteration of udc_irq()
and musb_peri_rx() and call it only from musb_peri_tx() when correct
interrupt bit in initrtx it set.

Address from SET ADDRESS command must be set to faddr register only after
acknowledging SERV_RXPKTRDY followed by received EP0 interrupt. So prior
calling musb_peri_ep0_set_address() check for EP0 interrupt instead of
(incorrect) MUSB_INTR_SOF interrupt.

This patch fixes issue that host (computer) cannot register U-Boot USB
device and is failing with errors:

    usb 1-1: new full-speed USB device number 86 using xhci_hcd
    usb 1-1: Device not responding to setup address.
    usb 1-1: Device not responding to setup address.
    usb 1-1: device not accepting address 86, error -71

U-Boot was writing address to faddr register too early and did not wait for
correct interrupt after which should update address.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agousb: musb: Fix receiving of bigger buffers
Pali Rohár [Sun, 7 Feb 2021 13:50:08 +0000 (14:50 +0100)]
usb: musb: Fix receiving of bigger buffers

If musb_peri_rx_ep() was called to process received HW buffer but U-Boot
cannot read it yet (e.g. because U-Boot SW buffer is full) then interrupt
was marked as processed also when HW buffer stayed unprocessed.

U-Boot tried to process this buffer again when it received interrupt again,
but it can receive it only when sender (host) sends a new data. As sender
(host) is not going to send a new data until U-Boot process current data
this issue caused a deadlock in case sender (host) is emitting data faster
than U-Boot can process it.

Reading musb intrrx register automatically clears this register and marks
interrupt as processed. So to prevent marking interrupt in U-Boot as
processed, adds a new variable pending_intrrx which would contain
unprocessed bits of intrrx register.

For a second step, every time when musb_peri_rx_ep() is called and there
are waiting data to be processed (signaled by MUSB_RXCSR_RXPKTRDY) either
acknowledge sender (via musb_peri_rx_ack()) that whole HW buffer was
processed or set corresponding bit in pending_intrrx that HW buffer was not
fully processed yet and next iteration is required after U-Boot allocates
space for reading HW buffer.

This patch fixes receiving large usb buffers, e.g. file transfer via Kermit
protocol implemented by 'loadb' U-Boot command over usbtty serial console.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agousb: musb: Fix transmission of bigger buffers
Pali Rohár [Sun, 7 Feb 2021 13:50:07 +0000 (14:50 +0100)]
usb: musb: Fix transmission of bigger buffers

If udc_endpoint_write() was called with bigger payload which does not fit
into one USB packet it is needed to transmit payload in more USB packets.
First packet is transmitted by udc_endpoint_write() call itself and other
packets are put into waiting queue.

Implement function musb_peri_tx() which checks if endpoints are ready for
transmit and continue transmission of waiting queue.

This patch fixes sending big output from printenv command over usbtty
serial console.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>>
3 years agousb: musb: Read value of PERI_RXCSR to 16bit variable
Pali Rohár [Sun, 7 Feb 2021 13:50:06 +0000 (14:50 +0100)]
usb: musb: Read value of PERI_RXCSR to 16bit variable

PERI_RXCSR is 16bit register so store its value into 16bit local variable.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agousb: musb: Fix configuring FIFO for endpoints
Pali Rohár [Sun, 7 Feb 2021 13:50:05 +0000 (14:50 +0100)]
usb: musb: Fix configuring FIFO for endpoints

This patch fixes configuring FIFOs for one-directional endpoints which have
only one queue (either RX or TX, but noth both).

Size of FIFO buffer is 2^(idx+3) bytes and starting address is 2^(addr+3).
Moreover first 64 bytes are reserved for EP0.

Without this patch if FIFO size specified by caller was zero then idx was
incorrectly calculated (expr. ffs(0)-1) and size overflowed in fifosz
register. This register uses has only 4 bits for FIFO size. Moreover
specifying zero buffer size is not possible (with idx=0 is minimal buffer
size 8 bytes).

So even for one-directional endpoints we need to correctly specify both
(RX and TX) FIFO buffer sizes and its addresses.

This patch is fixing calculation of start address and buffer size to
minimal value and ensures that it would not overlap with buffer reserved
for EP0.

This issue caused loose of packets on USB bus in both directions and
basically usbtty was unusable.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agousb: musb: Always clear the data toggle bit when configuring ep
Pali Rohár [Sun, 7 Feb 2021 13:50:04 +0000 (14:50 +0100)]
usb: musb: Always clear the data toggle bit when configuring ep

Without this patch clearing was done only when U-Boot was compiled with
MUSB Host Controller. But clearing of data toggle bit is needed also for
MUSB Device Controller otherwise Device Controller does not work correctly.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agousb: musb: Fix compilation of gadget code
Pali Rohár [Sun, 7 Feb 2021 13:50:03 +0000 (14:50 +0100)]
usb: musb: Fix compilation of gadget code

musb udc code depends on usb gadget code provided by CONFIG_USB_DEVICE as
defined in drivers/usb/gadget/Makefile. But this Makefile is not included
into U-Boot build when CONFIG_USB_GADGET is not set. As CONFIG_USB_DEVICE
cannot be enabled together with CONFIG_USB_GADGET it means that dependency
for musb udc code is not compiled during build. Fix it by including
drivers/usb/gadget dependency also when CONFIG_USB_DEVICE is set.

This patch fixes compile errors:

arm-linux-gnueabi-ld.bfd: drivers/usb/musb/built-in.o: in function `musb_peri_ep0_rx':
u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `ep0_recv_setup'
arm-linux-gnueabi-ld.bfd: drivers/usb/musb/built-in.o: in function `musb_peri_ep0_idle':
u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `ep0_recv_setup'
arm-linux-gnueabi-ld.bfd: drivers/usb/musb/built-in.o: in function `musb_peri_ep0_zero_data_request':
u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_device_event_irq'
arm-linux-gnueabi-ld.bfd: drivers/usb/musb/built-in.o: in function `musb_peri_ep0_idle':
u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `ep0_recv_setup'
arm-linux-gnueabi-ld.bfd: drivers/usb/musb/built-in.o: in function `musb_peri_ep0_rx':
u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_rcv_complete'
arm-linux-gnueabi-ld.bfd: drivers/usb/musb/built-in.o: in function `musb_peri_rx_ep':
u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_rcv_complete'
arm-linux-gnueabi-ld.bfd: drivers/usb/musb/built-in.o: in function `udc_endpoint_write':
u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_tx_complete'
arm-linux-gnueabi-ld.bfd: drivers/usb/musb/built-in.o: in function `udc_irq':
u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_device_event_irq'
arm-linux-gnueabi-ld.bfd: u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_device_event_irq'
arm-linux-gnueabi-ld.bfd: u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_device_event_irq'
arm-linux-gnueabi-ld.bfd: u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_device_event_irq'
arm-linux-gnueabi-ld.bfd: u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_device_event_irq'
arm-linux-gnueabi-ld.bfd: drivers/usb/musb/built-in.o:u-boot/drivers/usb/musb/musb_udc.c: more undefined references to `usbd_device_event_irq' follow
arm-linux-gnueabi-ld.bfd: drivers/usb/musb/built-in.o: in function `udc_setup_ep':
u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_alloc_urb'
arm-linux-gnueabi-ld.bfd: drivers/usb/musb/built-in.o: in function `udc_startup_events':
u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_device_event_irq'
arm-linux-gnueabi-ld.bfd: u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_device_event_irq'
arm-linux-gnueabi-ld.bfd: u-boot/drivers/usb/musb/musb_udc.c: undefined reference to `usbd_device_event_irq'
make: *** [Makefile:1762: u-boot] Error 1

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agoserial: usbtty: Send urb data in correct order
Pali Rohár [Sun, 7 Feb 2021 13:50:02 +0000 (14:50 +0100)]
serial: usbtty: Send urb data in correct order

Function next_urb() selects the last urb data buffer from linked list to
which next data from usbtty's puts function should be appended.

But to check if TX data still exists it is needed to look at the first urb
data buffer from linked list. So check for endpoint->tx_urb (first from the
linked list) instead of current_urb (the last from the linked list).

Successful call to udc_endpoint_write() may invalidate active urb and
allocate new urb in queue which invalidates pointer returned by next_urb()
function.

So call next_urb() prior putting data into urb buffer and call it every
time after using udc_endpoint_write() function to prevent sending data from
usbtty's puts function in incorrect order.

This patch fixes issue that usbtty code does not transmit data when they
are waiting in the tx queue.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agoserial: usbtty: Fix puts function
Pali Rohár [Sun, 7 Feb 2021 13:50:01 +0000 (14:50 +0100)]
serial: usbtty: Fix puts function

This function has incorrect implementation of prepending CR prior LF.
Without this patch it prepended CR prior whole string which is going to be
written and let LF without leading CR. Fix this issue by inserting CR at
correct place to make output on usbtty serial console more readable.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
3 years agoMerge tag 'rpi-next-2021.04.2' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 2 Mar 2021 21:46:16 +0000 (16:46 -0500)]
Merge tag 'rpi-next-2021.04.2' of https://source.denx.de/u-boot/custodians/u-boot-raspberrypi

- Disable Grub workaround for RPi2
- enable HS200 mode for iproc sdhci
- add armv7 support for iproc_rng200

3 years agoconfigs: Resync with savedefconfig
Tom Rini [Tue, 2 Mar 2021 14:36:23 +0000 (09:36 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoconfigs: rpi4_32: Enable iProc RNG200
Matthias Brugger [Fri, 26 Feb 2021 10:48:01 +0000 (11:48 +0100)]
configs: rpi4_32: Enable iProc RNG200

Enable the RNG driver for RPi4 with 32 bit.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
3 years agorng: iproc_rng200: Enable support for RPi4 armv7
Matthias Brugger [Fri, 26 Feb 2021 10:48:00 +0000 (11:48 +0100)]
rng: iproc_rng200: Enable support for RPi4 armv7

On the RPi4 armv7 build we have the situationt that we use physical
addresses of 64 bit, while the virtual addresses are 32 bit.
Remap the base address in this scenario via map_physmem().

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
3 years agoMAINTAINERS: Update info for Raspberry Pi
Matthias Brugger [Fri, 26 Feb 2021 10:23:16 +0000 (11:23 +0100)]
MAINTAINERS: Update info for Raspberry Pi

Add RPi config files and custodian repository.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
3 years agodrivers: mmc: iproc_sdhci: enable HS200 mode
Bharat Gooty [Fri, 26 Feb 2021 06:15:13 +0000 (11:45 +0530)]
drivers: mmc: iproc_sdhci: enable HS200 mode

Add tuning functionality which is needed for HS200 mode.
For HS200, program the correct needed 1.8 voltage

Signed-off-by: Bharat Gooty <bharat.gooty@broadcom.com>
Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
3 years agoconfigs: RPi2: Disable EFI Grub workaround
Matthias Brugger [Tue, 16 Feb 2021 19:54:08 +0000 (20:54 +0100)]
configs: RPi2: Disable EFI Grub workaround

The EFI Grub workaround isn't needed with Grub version 2.04 or higher.
This version was published over a year ago, so disable the workaround
to reduce boot time.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
3 years agoPrepare v2021.04-rc3
Tom Rini [Tue, 2 Mar 2021 03:46:41 +0000 (22:46 -0500)]
Prepare v2021.04-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoARM: imx: Include u-boot.img in u-boot-with-spl.imx if OF_SEPARATE=y
Marek Vasut [Mon, 1 Mar 2021 15:41:28 +0000 (16:41 +0100)]
ARM: imx: Include u-boot.img in u-boot-with-spl.imx if OF_SEPARATE=y

The u-boot-with-spl.imx is a concatenation of SPL and u-boot.uim.
The u-boot.uim is u-boot.bin wrapped in uImage. In case OF_SEPARATE
is enabled, the u-boot.bin does not contain control DT for U-Boot,
and so u-boot.uim does not contain the DT, and so u-boot-with-spl.imx
does not contain the DT, and a system where u-boot-with-spl.imx is
written to offset 1024B to the start of storage no longer boots, as
it is missing DT.

In case OF_SEPARATE is enabled, u-boot.img contains both u-boot.bin
and the necessary DTs. Therefore, use u-boot.img instead of u-boot.uim
to generate u-boot-with-spl.imx when OF_SEPARATE is enabled.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Christoph Niedermaier <cniedermaier@dh-electronics.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Ye Li <ye.li@nxp.com>
Cc: uboot-imx <uboot-imx@nxp.com>
3 years agolog: convert pr_*() to logging
Heinrich Schuchardt [Mon, 4 Jan 2021 07:02:55 +0000 (08:02 +0100)]
log: convert pr_*() to logging

In drivers we use a family of printing functions including pr_err() and
pr_cont(). CONFIG_LOGLEVEL is used to control which of these lead to output
via printf().

Our logging functions allow finer grained control of output. So replace
printf() by the matching logging functions. The usage of CONFIG_LOGLEVEL
remains unchanged.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: btrfs: do not fail when offset of a ROOT_ITEM is not -1
Marek Behún [Tue, 9 Feb 2021 17:33:37 +0000 (18:33 +0100)]
fs: btrfs: do not fail when offset of a ROOT_ITEM is not -1

When the btrfs_read_fs_root() function is searching a ROOT_ITEM with
location key offset other than -1, it currently fails via BUG_ON.

The offset can have other value than -1, though. This can happen for
example if a subvolume is renamed:

  $ btrfs subvolume create X && sync
  Create subvolume './X'
  $ btrfs inspect-internal dump-tree /dev/root | grep -B 2 'name: X$
        location key (270 ROOT_ITEM 18446744073709551615) type DIR
        transid 283 data_len 0 name_len 1
        name: X
  $ mv X Y && sync
  $ btrfs inspect-internal dump-tree /dev/root | grep -B 2 'name: Y$
        location key (270 ROOT_ITEM 0) type DIR
        transid 285 data_len 0 name_len 1
        name: Y

As can be seen the offset changed from -1ULL to 0.

Do not fail in this case.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: David Sterba <dsterba@suse.com>
Cc: Qu Wenruo <wqu@suse.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agoARM: imx: Do not hard-code MX8M MMU table DRAM entry offset
Marek Vasut [Sat, 27 Feb 2021 13:59:00 +0000 (14:59 +0100)]
ARM: imx: Do not hard-code MX8M MMU table DRAM entry offset

Instead of hard-coding the offset of DRAM entries in MMU table all over
the code, auto-detect the offset. This removes error-prone code which
would break e.g. in case the MMU table is modified.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Ye Li <ye.li@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agoARM: dts: imx8mq-evk: Remove u-boot,off-on-delay-us property
Fabio Estevam [Mon, 22 Feb 2021 17:40:47 +0000 (14:40 -0300)]
ARM: dts: imx8mq-evk: Remove u-boot,off-on-delay-us property

Commit 247bbeb74c18 ("ARM: dts: imx8m: increase off-on delay on the SD Vcc
regulator") caused the imx8mq-evk board to not be able to store the
environment variables in the SD card.

Remove the u-boot,off-on-delay-us property to fix the regression.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
3 years agotools: imx8mimage: Restore the original __ALIGN_MASK() macro
Fabio Estevam [Mon, 22 Feb 2021 16:16:43 +0000 (13:16 -0300)]
tools: imx8mimage: Restore the original __ALIGN_MASK() macro

Since commit c738adb8dbbf ("tool: Move ALIGN_MASK to header as common MACRO")
the i.MX8MQ EVK board no longer boots.

The reason is that imx8mimage.c used a custom __ALIGN_MASK() macro, so
restore the original macro to fix the boot and rename it accordingly.

Reported-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Ye Li <ye.li@nxp.com>
3 years agoarm: dts: imx8mp-evk: Add FEC PHY reset timing
Ye Li [Fri, 19 Feb 2021 06:33:48 +0000 (22:33 -0800)]
arm: dts: imx8mp-evk: Add FEC PHY reset timing

Add phy-reset-duration and phy-reset-post-delay to FEC node for PHY
reset, otherwise the PHY does not work correctly.

Signed-off-by: Ye Li <ye.li@nxp.com>
3 years agoimx: Add 2GB lpddr support for i.MX8MN Beacon EmbeddedWorks devkit.
Adam Ford [Tue, 16 Feb 2021 14:19:52 +0000 (08:19 -0600)]
imx: Add 2GB lpddr support for i.MX8MN Beacon EmbeddedWorks devkit.

There is a second lpddr configuration with 2GB of RAM, but this requires
different RAM timings, so in addition to adding the timing file, a
separate defconfig is necessary.

Signed-off-by: Adam Ford <aford173@gmail.com>
3 years agodoc: board: freescale: imx8mp_evk: update to newer versions and change ATF_LOAD_ADDR
Peter Bergin [Sun, 14 Feb 2021 19:19:22 +0000 (20:19 +0100)]
doc: board: freescale: imx8mp_evk: update to newer versions and change ATF_LOAD_ADDR

Update imx-atf and firmware-imx to latest released versions.

Update address of ATF_LOAD_ADDR that has changed to 0x970000 in imx-atf
commit 48733cb4e773a7584ced601de9d717efa3d73815.

Add 'O=' to make and build in separate directory as one issue has been noticed
where it was trouble building directly inside u-boot source dir. Restructure the workflow
and copy binaries after defconfig to ensure that build directory is created.

Signed-off-by: Peter Bergin <peter@berginkonsult.se>
Cc: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Reviewed-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
3 years agoARM: imx: Add missing FEC ethernet quirk for MX8M
Marek Vasut [Thu, 25 Feb 2021 21:02:26 +0000 (22:02 +0100)]
ARM: imx: Add missing FEC ethernet quirk for MX8M

The MX8M also contains a gigabit MAC, so define FEC_QUIRK_ENET_MAC.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agomx6sabre: Fix boot failure
Ye Li [Sun, 21 Feb 2021 02:25:45 +0000 (18:25 -0800)]
mx6sabre: Fix boot failure

CONFIG_SPL_LEGACY_IMAGE_SUPPORT is necessary for mx6sabresd and
mx6sabreauto, because u-boot is packed as legacy image not FIT.
However, this config is not set when CONFIG_SPL_LOAD_FIT is enabled.
Must enable it explicitly, otherwise will fail to boot like below.

U-Boot SPL 2021.04-rc2 (Feb 20 2021 - 16:43:04 -0800)
Trying to boot from MMC1
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices

Signed-off-by: Ye Li <ye.li@nxp.com>
3 years agommc: fsl_esdhc_imx: fix the DTOCV to 0xE
Haibo Chen [Fri, 19 Feb 2021 19:25:32 +0000 (11:25 -0800)]
mmc: fsl_esdhc_imx: fix the DTOCV to 0xE

On imx6Q/imx6DL, we find if config the DTOCV to 0~3, it will impact
cmd6 behavior, after cmd6 get transfer complete interrupt, the data0
line will keep low over 5 seconds. This should be a IC bug on imx6Q/DL.
For other platforms, do not has this issue.

To fix this issue, fix the DTOCV to 0xE, the max setting, this also align
with Linux configuration.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agomx23evk: Add myself as maintainer
Fabio Estevam [Thu, 18 Feb 2021 23:32:30 +0000 (20:32 -0300)]
mx23evk: Add myself as maintainer

I would like to help supporting this board, so add myself
as a maintainer.

Now that the board has been converted to DM, also add
its devicetree in the MAINTAINERS files entry.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
3 years agomx23evk: Convert to driver model
Fabio Estevam [Thu, 18 Feb 2021 23:32:29 +0000 (20:32 -0300)]
mx23evk: Convert to driver model

Make the conversion to driver model as it is mandatory.

Successfully tested booting Linux from the SD card.

Dropped splash screen support as this needs to be properly
converted to DM and tested.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
3 years agomx23-evk: Import devicetree file from Linux
Fabio Estevam [Thu, 18 Feb 2021 23:32:28 +0000 (20:32 -0300)]
mx23-evk: Import devicetree file from Linux

Import the imx23-evk devicetree files from Linux kernel
version 5.11.

This is in preparation for converting the mx23evk_defconfig
target to driver model.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
3 years agomx51evk: Add myself as maintainer
Fabio Estevam [Mon, 15 Feb 2021 11:58:18 +0000 (08:58 -0300)]
mx51evk: Add myself as maintainer

I would like to help supporting this board, so add myself
as a maintainer.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
3 years agomx51evk: Convert to driver model
Fabio Estevam [Mon, 15 Feb 2021 11:58:17 +0000 (08:58 -0300)]
mx51evk: Convert to driver model

Make the conversion to driver model as it is mandatory.

Tested booting the Linux kernel from the SD card.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
3 years agoimx51-babbage: Import devicetree files from Linux
Fabio Estevam [Mon, 15 Feb 2021 11:58:16 +0000 (08:58 -0300)]
imx51-babbage: Import devicetree files from Linux

Import the imx51-babbage devicetree files from Linux kernel
version 5.11-rc7.

This is in preparation for converting the mx51evk_defconfig
target to driver model.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
3 years agommc: fsl_esdhc_imx: Add a compatible for i.MX51
Fabio Estevam [Mon, 15 Feb 2021 11:58:15 +0000 (08:58 -0300)]
mmc: fsl_esdhc_imx: Add a compatible for i.MX51

Add a compatible for i.MX51 so that i.MX51 can use this driver
via driver model.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agomx53loco: Add myself as maintainer
Fabio Estevam [Sun, 14 Feb 2021 01:49:54 +0000 (22:49 -0300)]
mx53loco: Add myself as maintainer

I would like to help supporting this board, so add myself
as a maintainer.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
3 years agoARM: dts: imx53-qsb: Describe the esdhc1 card detect pin
Fabio Estevam [Sun, 14 Feb 2021 01:49:53 +0000 (22:49 -0300)]
ARM: dts: imx53-qsb: Describe the esdhc1 card detect pin

The micro SD card slot uses GPIO3_13 as card detect pin, so describe
it in the devicetree.

This was noticed when converting imx53-qsb board to driver model
in U-Boot as the micro SD card was not getting detected.

After this change it is possible to load the dtb and zImage
from the SD card and boot Linux.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
3 years agomx53loco: Convert to driver model
Fabio Estevam [Sun, 14 Feb 2021 01:49:52 +0000 (22:49 -0300)]
mx53loco: Convert to driver model

Make the conversion to driver model as it is mandatory.

Remove the SATA support for now as the i.MX53 support has not
been added yet.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
3 years agoimx53-qsb: Import devicetree files from Linux
Fabio Estevam [Sun, 14 Feb 2021 01:49:51 +0000 (22:49 -0300)]
imx53-qsb: Import devicetree files from Linux

Import the imx53-qsb devicetree files from Linux kernel
version 5.11-rc7.

This is in preparation for converting the mx53loco_defconfig
target to driver model.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
3 years agoboard: toradex: move RGMII delays to PHY side
Oleksandr Suvorov [Tue, 9 Feb 2021 08:38:13 +0000 (10:38 +0200)]
board: toradex: move RGMII delays to PHY side

The RGMII link delays can be set on either MAC or PHY side. Set the
rgmii-id PHY mode for FEC and remove FEC_ENET_ENABLE_.XC_DELAY
setting, so that these definitions aren't used anymore throughout
the U-Boot.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agoARM: imx8: Add missing FEC ENET quirk for i.MX8/i.MX8X
Oleksandr Suvorov [Tue, 9 Feb 2021 08:38:12 +0000 (10:38 +0200)]
ARM: imx8: Add missing FEC ENET quirk for i.MX8/i.MX8X

Both NXP SoCs i.MX8 and i.MX8X have ENET gigabit MAC.
Define FEC_QUIRK_ENET_MAC for the imx8 platform and remove this
definition from configs of boards, based on MX8/MX8X.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
Acked-by: Oliver Graute <oliver.graute@kococonnector.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agoRespect that some compression algos can be enabled separately for SPL
Frieder Schrempf [Sat, 6 Feb 2021 00:11:06 +0000 (16:11 -0800)]
Respect that some compression algos can be enabled separately for SPL

Some compression algorithms currently can be enabled for SPL and
U-Boot proper separately. Therefore take into account USE_HOSTCC
is well as CONFIG_IS_ENABLED() in these cases to prevent compiling these
functions in case of a host tool build.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agothermal: imx_tmu: enable monitoring and default alert/critical
Tim Harvey [Sat, 6 Feb 2021 00:11:05 +0000 (16:11 -0800)]
thermal: imx_tmu: enable monitoring and default alert/critical

Set default critical/alert temperature and enabling monoitoring.

Without calling imx_tmu_enable_msite() monitoring will not be enabled
and read_temperature will return 0. Additionally without setting alert
temperature will cause imx_tmu_get_temp() to spin indefiniately thinking
the system needs to cool.

This resolves the board spinning endlessly when enabling IMX_TMU in the
SPL.

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoARM: mx6: Add function to set serial#
Sean Anderson [Thu, 4 Feb 2021 21:44:22 +0000 (16:44 -0500)]
ARM: mx6: Add function to set serial#

The serial number OTP is similar to the imx7 version, except that the
register names are different. This also sets serial# directly, instead of
providing board_get_serial.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agoARM: imx6: mx6sabre-common: Search for boot components in /boot too
Marek Vasut [Thu, 4 Feb 2021 18:00:32 +0000 (19:00 +0100)]
ARM: imx6: mx6sabre-common: Search for boot components in /boot too

Some root filesystem configurations do not have separate /boot partition,
but rather place kernel, DT, scripts into /boot directory. Search the /boot
directory for these boot components in case they are not found in /, which
is the old behavior.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Ye Li <ye.li@nxp.com>
Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agoARM: imx6: mx6sabre-common: Replace fatload with FS_GENERIC load
Marek Vasut [Thu, 4 Feb 2021 18:00:31 +0000 (19:00 +0100)]
ARM: imx6: mx6sabre-common: Replace fatload with FS_GENERIC load

Replace filesystem specific fatload command with a filesystem agnostic
load command, so the board can boot from e.g. ext4 too.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Ye Li <ye.li@nxp.com>
Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agouboot-test-hooks: Switch to our GitLab instance
Tom Rini [Wed, 24 Feb 2021 22:05:04 +0000 (17:05 -0500)]
uboot-test-hooks: Switch to our GitLab instance

As Stephen is no longer actively maintaining the uboot-test-hooks
repository, switch to using the instance on our GitLab.

Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoCorrect U-Boot upstream repository
Heinrich Schuchardt [Wed, 24 Feb 2021 12:19:04 +0000 (13:19 +0100)]
Correct U-Boot upstream repository

The U-Boot source moves to https://source.denx.de/u-boot/u-boot.git
effective 2021-02-28.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoARM: imx6: dh-imx6: Drop the SF hunk in config
Marek Vasut [Thu, 4 Feb 2021 00:17:02 +0000 (01:17 +0100)]
ARM: imx6: dh-imx6: Drop the SF hunk in config

There is now CONFIG_SPL_DM_SPI{,_FLASH}, however keeping
CONFIG_DM_SPI{,_FLASH} enabled in SPL seems to grow the SPL
by a couple of bytes:
      text    data     bss     dec     hex filename
 -   34069    1568      96   35733    8b95 spl/u-boot-spl
 +   34075    1568      96   35739    8b9b spl/u-boot-spl
In either case, the binary is bootable, so remove the part
in board config.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Andreas Geisreiter <ageisreiter@dh-electronics.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Ludwig Zenz <lzenz@dh-electronics.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@konsulko.com>
3 years agoARM: imx6: dh-imx6: Enable support for applying DTO
Marek Vasut [Wed, 3 Feb 2021 22:22:17 +0000 (23:22 +0100)]
ARM: imx6: dh-imx6: Enable support for applying DTO

Enable DTO support to make it possible to boot fitImage with DTOs
embedded in them.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
3 years agoARM: imx: Revert "dh_imx6: Switch to full DM-aware"
Marek Vasut [Wed, 3 Feb 2021 21:36:33 +0000 (22:36 +0100)]
ARM: imx: Revert "dh_imx6: Switch to full DM-aware"

This reverts commit 03a673cf49e ("dh_imx6: Switch to full DM-aware").
According to discussion [1], the patch is known to break the dh_imx6
board, however it made it upstream just before 2021.01-rc4, likely by
mistake. Revert this patch to put the board back into working order.

Also note that this board has no DM SPL support due to OCRAM size
limitations, but that is fine, as SPL DM support is optional.

[1] https://lists.denx.de/pipermail/u-boot/2020-June/417986.html

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Andreas Geisreiter <ageisreiter@dh-electronics.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Ludwig Zenz <lzenz@dh-electronics.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@konsulko.com>
3 years agoMerge tag 'efi-2021-04-rc3-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 27 Feb 2021 13:06:10 +0000 (08:06 -0500)]
Merge tag 'efi-2021-04-rc3-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2021-04-rc3-2

Bug fixes:
* debug build for mkeficapsule
* limit output length for VenHw, VenMedia
* ACPI tables must be in EfiACPIReclaimMemory

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Fri, 26 Feb 2021 20:11:08 +0000 (15:11 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

- fastboot updates / fixes

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-spi
Tom Rini [Fri, 26 Feb 2021 17:41:19 +0000 (12:41 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-spi

- new GigaDevice flash ids
- fixes for imx, nxp_spi drivers

3 years agoMerge tag 'u-boot-stm32-20210226' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Fri, 26 Feb 2021 17:41:06 +0000 (12:41 -0500)]
Merge tag 'u-boot-stm32-20210226' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- Add USB host boot support in stm32mp1 config
- Enable uefi related commands for STMicroelectronics STM32MP15 boards
- Remove duplicate uart nodes in stm32mp15 device tree

3 years agocmd/efidebug: add firmware management protocol GUID
Heinrich Schuchardt [Fri, 26 Feb 2021 16:57:47 +0000 (17:57 +0100)]
cmd/efidebug: add firmware management protocol GUID

Add missing GUID short text used in the efidebug tables and efidebug dh
sub-commands.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: fix documentation in efi_loader.h
Heinrich Schuchardt [Thu, 25 Feb 2021 07:02:37 +0000 (08:02 +0100)]
efi_loader: fix documentation in efi_loader.h

Correct missing descriptions and typos in efi_loader.h.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: limit output length for VenHw, VenMedia
Heinrich Schuchardt [Tue, 23 Feb 2021 20:15:35 +0000 (21:15 +0100)]
efi_loader: limit output length for VenHw, VenMedia

VenHw and VenMedia device path nodes may carry vendor defined data of
arbitrary length. When converting a device path node to text ensure that we
do not overrun our internal buffer.

In our implementation of
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL.ConvertDevicePathToText() we could first
determine the output length and then allocate buffers but that would nearly
double the code size. Therefore keep the preallocated buffers and truncate
excessive device paths instead.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agotools/mkeficapsule.c: fix DEBUG build
Klaus Heinrich Kiwi [Sat, 20 Feb 2021 20:40:45 +0000 (17:40 -0300)]
tools/mkeficapsule.c: fix DEBUG build

Fix a missing comma sign (,) from a printf(), that is only
reachable if DEBUG is defined, in which case the build fails with:

    tools/mkeficapsule.c:266:36: error: expected ‘)’ before ‘bin’
      266 |  printf("\tbin: %s\n\ttype: %pUl\n" bin, guid);
          |                                    ^~~~
          |                                    )

Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoMAINTAINERS: assign tools/mkeficapsule.c to EFI PAYLOAD
Heinrich Schuchardt [Mon, 22 Feb 2021 19:26:34 +0000 (20:26 +0100)]
MAINTAINERS: assign tools/mkeficapsule.c to EFI PAYLOAD

tools/mkeficapsule.c is used to prepare test files for testing the UEFI
sub-system.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: ACPI tables must be in EfiACPIReclaimMemory
Heinrich Schuchardt [Sun, 21 Feb 2021 09:16:58 +0000 (10:16 +0100)]
efi_loader: ACPI tables must be in EfiACPIReclaimMemory

The UEFI spec does not allow ACPI tables to be in runtime services memory.
It recommends EfiACPIReclaimMemory.

Remove a superfluous check that the allocated pages are 16 byte aligned.
EFI pages are 4 KiB aligned.

Fixes: 86df34d42b05 ("efi_loader: Install ACPI configuration tables")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoconfigs: stm32mp1: enable uefi related commands
Ilias Apalodimas [Fri, 26 Feb 2021 12:52:51 +0000 (14:52 +0200)]
configs: stm32mp1: enable uefi related commands

The board can boot with UEFI. With the latest changes in U-Boot's
EFI subsystem we also have support for EFI runtime variables, without
SetVariable support.  We can also store the EFI variables in a file on the
ESP partition and preserve them across reboots.
The env and efidebug commands are missing in order to configure
EFI variables and the efibootmgr though.  Since U-Boot's default config
enables other EFI related commands (e.g bootefi), let's add the env related
and efidebug commands and allow users to do that

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoarm: dts: stm32mp15: remove duplicate uart nodes
Patrick Delaunay [Wed, 24 Feb 2021 10:00:56 +0000 (11:00 +0100)]
arm: dts: stm32mp15: remove duplicate uart nodes

Remove duplicated uart nodes introduced with commit 62f95af92a3f
("ARM: dts: stm32mp1: DT alignment with Linux kernel v5.9-rc4"),
because the uart nodes wasn't correctly ordered in alphabetic order.

Only cosmetic: the generated device tree don't change.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agoARM: stm32: Add USB host boot support
Marek Vasut [Fri, 12 Feb 2021 12:50:52 +0000 (13:50 +0100)]
ARM: stm32: Add USB host boot support

Add support for booting from USB pen drive, since USB host port is
available on the STM32MP1.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agousb: gadget: dwc2_udc_otg: Fix dwc2_gadget_start() and usb_gadget_register_driver()
Patrice Chotard [Wed, 17 Feb 2021 09:17:27 +0000 (10:17 +0100)]
usb: gadget: dwc2_udc_otg: Fix dwc2_gadget_start() and usb_gadget_register_driver()

Since commit 8745b9ebccae ("usb: gadget: add super speed support")
ums was no more functional on platform which use dwc2_udc_otg driver.

This was due to a too restrictive test which checked that the gadget
driver speed was either FS or HS.

So all gadget driver with max speed set to speed higher than
HS (SS in case of composite gadget driver in our case) are not
allowed, which is wrong.

Update the speed test in usb_gadget_register_driver() and in
dwc2_gadget_start() to allow all gadget driver speed equal or higher
than FS.

Tested on stm32mp157c-ev1 board.

Fixes: c791c8431c34 ("usb: dwc2: convert driver to DM_USB_GADGET")

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agousb: kbd: Also accept keyboards with Interrupt OUT endpoint
Stefan Brüns [Sat, 20 Feb 2021 16:26:06 +0000 (17:26 +0100)]
usb: kbd: Also accept keyboards with Interrupt OUT endpoint

The OUT endpoint can just be ignored as it is not used, just as the
corresponding Set_Report request for IN-only interfaces. E.g. the
Linux gadget hid keyboard also provides an interrupt endpoint.

Also cleanup confusing debug messages like "found set protocol", which
is printed when a keyboard device is found, while the Set_Protocol request
is issued quite some time later.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
3 years agofastboot: add UUU command UCmd and ACmd support
Heiko Schocher [Wed, 10 Feb 2021 08:29:03 +0000 (09:29 +0100)]
fastboot: add UUU command UCmd and ACmd support

add support for the UUU commands ACmd and UCmd.

Enable them through the Kconfig option
CONFIG_FASTBOOT_UUU_SUPPORT

base was commit in NXP kernel
9b149c2a2882: ("MLK-18591-3 android: Add FSL android fastboot support")

and ported it to current mainline. Tested this patch
on imx6ul based board.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agodoc: Document partition specifications
Sean Anderson [Fri, 5 Feb 2021 14:39:02 +0000 (09:39 -0500)]
doc: Document partition specifications

This documents the way U-Boot understands partitions specifications.
This also updates the fastboot documentation for the changes in the
previous commit.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: Rename k210 partitions anchor
Sean Anderson [Fri, 5 Feb 2021 14:39:01 +0000 (09:39 -0500)]
doc: Rename k210 partitions anchor

This anchor is only for the k210 partition layout, so rename it
appropriately. This keeps it from conflicting with the (to be added)
anchor for U-Boot partitions in general.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofastboot: Allow u-boot-style partitions
Sean Anderson [Fri, 5 Feb 2021 14:39:00 +0000 (09:39 -0500)]
fastboot: Allow u-boot-style partitions

This adds support for partitions of the form "dev.hwpart:part" and
"dev#partname". This allows one to flash to eMMC boot partitions without
having to use CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT. It also allows one to
flash to an entire device without needing CONFIG_FASTBOOT_MMC_USER_NAME.
Lastly, one can also flash MMC devices other than
CONFIG_FASTBOOT_FLASH_MMC_DEV.

Because devices can be specified explicitly, CONFIG_FASTBOOT_FLASH_MMC_DEV
is used only when necessary for existing functionality. For those cases,
fastboot_mmc_get_dev has been added as a helper function. This allows

There should be no conflicts with the existing system, but just in case, I
have ordered detection of these names after all existing names.

The fastboot_mmc_part test has been updated for these new names.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofastboot: Move part_get_info_by_name_or_alias after raw_part_get_info_by_name
Sean Anderson [Fri, 5 Feb 2021 14:38:59 +0000 (09:38 -0500)]
fastboot: Move part_get_info_by_name_or_alias after raw_part_get_info_by_name

This makes the next commit more readable by doing the move now.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofastboot: Remove mmcpart argument from raw_part_get_info_by_name
Sean Anderson [Fri, 5 Feb 2021 14:38:58 +0000 (09:38 -0500)]
fastboot: Remove mmcpart argument from raw_part_get_info_by_name

The only thing mmcpart was used for was to pass to blk_dselect_hwpart.
This calls blk_dselect_hwpart directly from raw_part_get_info_by_name. The
error handling is dropped, but it is reintroduced in the next commit
(albeit less specificly).

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopart: Support string block devices in part_get_info_by_dev_and_name
Sean Anderson [Fri, 5 Feb 2021 14:38:57 +0000 (09:38 -0500)]
part: Support string block devices in part_get_info_by_dev_and_name

This adds support for things like "#partname" and "0.1#partname". The block
device parsing is done like in blk_get_device_part_str.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopart: Support getting whole disk from part_get_info_by_dev_and_name_or_num
Sean Anderson [Fri, 5 Feb 2021 14:38:56 +0000 (09:38 -0500)]
part: Support getting whole disk from part_get_info_by_dev_and_name_or_num

This adds an option to part_get_info_by_dev_and_name_or_num to allow
callers to specify whether whole-disk partitions are fine.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopart: Give several functions more useful return values
Sean Anderson [Fri, 5 Feb 2021 14:38:55 +0000 (09:38 -0500)]
part: Give several functions more useful return values

Several functions in disk/part.c just return -1 on error. This makes them
return different errnos for different failures. This helps callers
differentiate between failures, even if they cannot read stdout.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: dm: Add test for fastboot mmc partition naming
Sean Anderson [Fri, 5 Feb 2021 14:38:54 +0000 (09:38 -0500)]
test: dm: Add test for fastboot mmc partition naming

This test verifies the mapping between fastboot partitions and partitions
as understood by U-Boot. It also tests the creation of GPT partitions,
though that is not the primary goal.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agommc: sandbox: Add support for writing
Sean Anderson [Fri, 5 Feb 2021 14:38:53 +0000 (09:38 -0500)]
mmc: sandbox: Add support for writing

This adds support writing to the sandbox mmc backed by an in-memory
buffer. The unit test has been updated to test reading, writing, and
erasing. I'm not sure what MMCs erase to; I picked 0, but if it's 0xFF
then that can be easily changed.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>