]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agousb: udc: ci: update speed handling
Li Jun [Mon, 25 Jan 2021 13:43:58 +0000 (21:43 +0800)]
usb: udc: ci: update speed handling

Remove the gadget driver speed check, and set its max_speed to
be USB_SPEED_HIGH.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: composite: force gadget to be USB2 for HS only function
Li Jun [Mon, 25 Jan 2021 13:43:57 +0000 (21:43 +0800)]
usb: composite: force gadget to be USB2 for HS only function

If one of functions is not super speed capable, we need force the udc
to be high speed, this is an equivalent implementation of
usb_gadget_udc_set_speed() in kernel but simple, which set the gadget
max_speed to be high speed, so afterwards when start gadget duc can
set the HW to be USB 2.0 mode.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: dnl: set dnl to be super speed
Li Jun [Mon, 25 Jan 2021 13:43:56 +0000 (21:43 +0800)]
usb: gadget: dnl: set dnl to be super speed

Set its max_speed to be super speed.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: fastboot: add super speed support
Li Jun [Mon, 25 Jan 2021 13:43:55 +0000 (21:43 +0800)]
usb: fastboot: add super speed support

Add super speed EP config.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: add super speed support
Li Jun [Mon, 25 Jan 2021 13:43:54 +0000 (21:43 +0800)]
usb: gadget: add super speed support

This patch is to add usb gadget super speed support in common
driver, including BOS descriptor and select the super speed
descriptor from function driver.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: update os_desc_config when add config
Jun Li [Mon, 25 Jan 2021 13:43:53 +0000 (21:43 +0800)]
usb: gadget: update os_desc_config when add config

Always use the new added config for os_desc_config to fix cdev->
os_desc_config may miss set in case we restart usb gadget driver.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: set correct usb_configuration for os_desc_config
Jun Li [Mon, 25 Jan 2021 13:43:52 +0000 (21:43 +0800)]
usb: gadget: set correct usb_configuration for os_desc_config

The current way to set cdev->os_desc_config is wrong if user restart
fastboot, as the old config is not used anymore and new allocated
usb_configuration will be used, so set the os_desc_config while
usb_add_config.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: fastboot: add ext properties for WCID
Li Jun [Mon, 25 Jan 2021 13:43:51 +0000 (21:43 +0800)]
usb: gadget: fastboot: add ext properties for WCID

Add device interface GUID for Microsoft Extended Properties Feature
Descriptor.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: add WCID support for mfgtool
Li Jun [Mon, 25 Jan 2021 13:43:50 +0000 (21:43 +0800)]
usb: gadget: add WCID support for mfgtool

Enable WCID(Microsoft Compatible ID Feature Descriptor) for mfgtool.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: OS Feature Descriptors support
Li Jun [Mon, 25 Jan 2021 13:43:49 +0000 (21:43 +0800)]
usb: gadget: OS Feature Descriptors support

This is a proting patch from linux kernel: 37a3a533429e
("usb: gadget: OS Feature Descriptors support"), the original commit
log see below:

There is a custom (non-USB IF) extension to the USB standard:

http://msdn.microsoft.com/library/windows/hardware/gg463182

They grant permission to use the specification - there is
"Microsoft OS Descriptor Specification License Agreement"
under the link mentioned above, and its Section 2 "Grant
of License", letter (b) reads:

"Patent license. Microsoft hereby grants to You a nonexclusive,
royalty-free, nontransferable, worldwide license under Microsoft鈥檚
patents embodied solely within the Specification and that are owned
or licensable by Microsoft to make, use, import, offer to sell,
sell and distribute directly or indirectly to Your Licensees Your
Implementation. You may sublicense this patent license to Your
Licensees under the same terms and conditions."

The said extension is maintained by Microsoft for Microsoft.

Yet it is fairly common for various devices to use it, and a
popular proprietary operating system expects devices to provide
"OS descriptors", so Linux-based USB gadgets whishing to be able
to talk to a variety of operating systems should be able to provide
the "OS descriptors".

This patch adds optional support for gadgets whishing to expose
the so called "OS Feature Descriptors", that is "Extended Compatibility ID"
and "Extended Properties".

Hosts which do request "OS descriptors" from gadgets do so during
the enumeration phase and before the configuration is set with
SET_CONFIGURATION. What is more, those hosts never ask for configurations
at indices other than 0. Therefore, gadgets whishing to provide
"OS descriptors" must designate one configuration to be used with
this kind of hosts - this is what os_desc_config is added for in
struct usb_composite_dev. There is an additional advantage to it:
if a gadget provides "OS descriptors" and designates one configuration
to be used with such non-USB-compliant hosts it can invoke
"usb_add_config" in any order because the designated configuration
will be reported to be at index 0 anyway.

This patch also adds handling vendor-specific requests addressed
at device or interface and related to handling "OS descriptors"."

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: add Kconfig for OS descriptors
Peng Fan [Mon, 25 Jan 2021 13:43:48 +0000 (21:43 +0800)]
usb: gadget: add Kconfig for OS descriptors

Add Kconfig for OS descriptors

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: move utf8_to_utf16le to header file
Li Jun [Mon, 25 Jan 2021 13:43:47 +0000 (21:43 +0800)]
usb: gadget: move utf8_to_utf16le to header file

As other users may use utf8_to_utf16le() to convert the utf8
to utf16 for usb, so move it to head file.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: OS String support
Li Jun [Mon, 25 Jan 2021 13:43:46 +0000 (21:43 +0800)]
usb: gadget: OS String support

This is a porting patch from linux kernel: 19824d5eeece
("usb: gadget: OS String support"), original commit log
see below:

"There is a custom (non-USB IF) extension to the USB standard:

http://msdn.microsoft.com/library/windows/hardware/gg463182

They grant permission to use the specification - there is
"Microsoft OS Descriptor Specification License Agreement"
under the link mentioned above, and its Section 2 "Grant
of License", letter (b) reads:

"Patent license. Microsoft hereby grants to You a nonexclusive,
royalty-free, nontransferable, worldwide license under Microsoft鈥檚
patents embodied solely within the Specification and that are owned
or licensable by Microsoft to make, use, import, offer to sell,
sell and distribute directly or indirectly to Your Licensees Your
Implementation. You may sublicense this patent license to Your
Licensees under the same terms and conditions."

The said extension is maintained by Microsoft for Microsoft.

Yet it is fairly common for various devices to use it, and a
popular proprietary operating system expects devices to provide
"OS descriptors", so Linux-based USB gadgets whishing to be able
to talk to a variety of operating systems should be able to provide
the "OS descriptors".

This patch adds optional support for gadgets whishing to expose
the so called "OS String" under index 0xEE of language 0.
The contents of the string is generated based on the qw_sign
array and b_vendor_code.

Interested gadgets need to set the cdev->use_os_string flag,
fill cdev->qw_sign with appropriate values and fill cdev->b_vendor_code
with a value of their choice.

This patch does not however implement responding to any vendor-specific
USB requests."

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: don't change ep name for dwc3 while ep autoconfig
Li Jun [Mon, 25 Jan 2021 13:43:45 +0000 (21:43 +0800)]
usb: gadget: don't change ep name for dwc3 while ep autoconfig

As the SDP protocol use the predefined ep num for communication, we can't
change its name hence reset its ep num while do ep autoconfig, this is
only apply for SPL.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: Add ep_config call back to usb_gadget_ops
Ye Li [Mon, 25 Jan 2021 13:43:44 +0000 (21:43 +0800)]
usb: gadget: Add ep_config call back to usb_gadget_ops

Since some new fields in usb_ep structure been moved to usb_ss_ep.
The CDNS3 gadget driver should replies on this operation to bind the
usb_ss_ep with the endpoint descriptor when function layer uses
usb_ep_autoconfig to add endpoint descriptors to gadget. So that
CDNS3 driver can know the EP information and configure the EP once
the set configuration request is received.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: Do not export usbd_device_* arrays
Pali Rohár [Sat, 26 Dec 2020 18:12:11 +0000 (19:12 +0100)]
usb: gadget: Do not export usbd_device_* arrays

Each array is used only in one file (core.c or ep0.c). Move their content
to correct file, mark them as static and do not export out of current file.

This change allows to decrease size of u-boot.bin as more of those strings
are not used.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agothor: add support for the dfu_alt_info reintialization from the flashed script
Marek Szyprowski [Tue, 22 Dec 2020 10:32:24 +0000 (11:32 +0100)]
thor: add support for the dfu_alt_info reintialization from the flashed script

Reinitialize dfu_env_entities after flashing the 'SCRIPT' entity to
ensure that the potential changes to the 'dfu_alt_info' environment
variable are applied.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodfu: add support for the dfu_alt_info reintialization from the flashed script
Marek Szyprowski [Tue, 22 Dec 2020 10:32:23 +0000 (11:32 +0100)]
dfu: add support for the dfu_alt_info reintialization from the flashed script

Reinitialize DFU USB gadget after flashing the 'SCRIPT' entity to ensure
that the potential changes to the 'dfu_alt_info' environment variable are
applied.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
[lukma - I've moved the bool retry to avoid build (CI) errors]

3 years agodfu: add 'SCRIPT' entity
Marek Szyprowski [Tue, 22 Dec 2020 10:32:22 +0000 (11:32 +0100)]
dfu: add 'SCRIPT' entity

Define a new 'SCRIPT' type for DFU entities. The downloaded data are
treated as simple u-boot's scripts and executed with run_command_list()
function.

Flashing the 'SCRIPT' entity might result in changing the 'dfu_alt_info'
environment variable from the flashed script, so add a global variable
for tracking the potential need to reinitialize the dfu_alt_info related
structures.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodfu: add 'SKIP' entity
Jaehoon Chung [Tue, 22 Dec 2020 10:32:21 +0000 (11:32 +0100)]
dfu: add 'SKIP' entity

Define a new 'SKIP' type for the DFU entities. The flashed data for that
entity is simply ignored without returning any error values.

This allows to have one flashing procedure and images for the different
board types or variants, where each board uses only the images relevant
to it and skips the rest. This is especially usefull for the THOR
protocol, which usually transfers more than one file in a single session.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
[mszyprow: rephrased commit message and docs for easier reading, changed
   subject to "dfu: add 'SKIP' entity"]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodfu: mmc: use the default MMC device if entity specifies it as -1
Marek Szyprowski [Tue, 22 Dec 2020 10:32:20 +0000 (11:32 +0100)]
dfu: mmc: use the default MMC device if entity specifies it as -1

Use the default MMC device set in the command line if entity specifies it
as -1. This allows to use the same dfu_alt_info string for different MMC
devices (like embedded eMMC and external SD card if data layout is the
same on both devices).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agocmd: usb_mass_storage: show device interface name
Marek Szyprowski [Thu, 17 Dec 2020 10:47:11 +0000 (11:47 +0100)]
cmd: usb_mass_storage: show device interface name

Show the interface name (i.e. 'mmc') in the information string to ease
user checking which device is exported via USB Mass Storage protocol.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agof_fastboot: Avoid use-after-free in the global pointer variable
Andy Shevchenko [Thu, 3 Dec 2020 15:32:05 +0000 (17:32 +0200)]
f_fastboot: Avoid use-after-free in the global pointer variable

In case of usb_add_function() failure the error path has an issue,
i.e the global pointer variable is assigned to garbage

Fix the above mentioned issue by assigning pointer to NULL.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agof_rockusb: Avoid use-after-free in the global pointer variable
Andy Shevchenko [Thu, 3 Dec 2020 15:32:04 +0000 (17:32 +0200)]
f_rockusb: Avoid use-after-free in the global pointer variable

In case of usb_add_function() failure the error path has two issues:
 - the potentially allocated structure isn't getting freed
 - the global pointer variable is assigned to garbage

Fix the above mentioned issues by freeing memory and assigning NULL.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agof_rockusb: Use NULL instead of 0 for pointers
Andy Shevchenko [Thu, 3 Dec 2020 15:32:03 +0000 (17:32 +0200)]
f_rockusb: Use NULL instead of 0 for pointers

get_rkusb() mistakenly uses integers without cast.
Convert them to proper type.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agocmd: bcb: Add support for processing const string literals in bcb_set()
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:23 +0000 (11:52 +0300)]
cmd: bcb: Add support for processing const string literals in bcb_set()

On request/suggestion from Simon Glass back in May 22 2019 [1], the
'strsep' mechanism implemented in bcb_set() was set to work directly
with user-provided argv strings, to avoid duplicating memory and for
the sake of simpler implementation.

However, since we recently exposed bcb_write_reboot_reason() API to be
called by U-Boot fastboot, the idea is to be able to pass const string
literals to this new BCB API, carrying the reboot reason.

Since 'strsep' (just like its older/superseded sibling 'strtok')
modifies the input string passed as parameter, BCB command in its
current state would attempt to perform in-place modifications in a
readonly string, which might lead to unexpected results.

Fix the above with the cost of one dynamic memory allocation ('strdup').
This will also ensure no compiler warnings when passing string literals
to bcb_write_reboot_reason().

[1] http://u-boot.10912.n7.nabble.com/PATCH-v2-0-2-Add-bcb-command-to-read-modify-write-Android-BCB-td369934i20.html#a370456

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agocmd: bcb: Expose 'bcb_write_reboot_reason' to external callers
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:22 +0000 (11:52 +0300)]
cmd: bcb: Expose 'bcb_write_reboot_reason' to external callers

Fastboot is evolving and beginning with commit [1], the
upstream implementation expects bootloaders to offer support for:
 - reboot-recovery
 - reboot-fastboot

The most natural way to achieve the above is through a set of
pre-defined "reboot reason" strings, written into / read from
the BCB "command" field, e.g.:
 - bootonce-bootloader [2]
 - boot-fastboot [3]
 - boot-recovery [4]

Expose the first 'bcb' API meant to be called by e.g. fastboot stack,
to allow updating the BCB reboot reason via the BCB 'command' field.

[1] https://android.googlesource.com/platform/system/core/+/dea91b4b5354af2
    ("Add fastbootd.")
[2] https://android.googlesource.com/platform/bootable/recovery/+/cba7fa88d8b9
    ("Add 'reboot bootloader' to bootloader_message.")
[3] https://android.googlesource.com/platform/bootable/recovery/+/eee4e260f9f6
    ("recovery: Add "boot-fastboot" command to BCB.")
[4] https://android.googlesource.com/platform/system/core/+/5e98b633a748695f
    ("init: Write the reason in BCB on "reboot recovery"")

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
[lukma - added missing #include <linux/errno.h> to avoid build breaks]

3 years agocmd: bcb: Extract '__bcb_store' from 'do_bcb_store' for internal needs
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:21 +0000 (11:52 +0300)]
cmd: bcb: Extract '__bcb_store' from 'do_bcb_store' for internal needs

Enriching the functionality of U-Boot 'bcb' may assume using the
existing sub-commands as building blocks for the next ones.

A clean way to achive the above is to expose a number of static
routines, each mapped to an existing user command (e.g. load/set/store),
with a user/caller-friendly prototype (i.e. do not force the caller
to wrap an integer into a string).

This third patch makes '__bcb_store' available for internal needs.

No functional change intended.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agocmd: bcb: Extract '__bcb_set' from 'do_bcb_set' for internal needs
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:20 +0000 (11:52 +0300)]
cmd: bcb: Extract '__bcb_set' from 'do_bcb_set' for internal needs

Enriching the functionality of U-Boot 'bcb' may assume using the
existing sub-commands as building blocks for the next ones.

A clean way to achive the above is to expose a number of static
routines, each mapped to an existing user command (e.g. load/set/store),
with a user/caller-friendly prototype (i.e. do not force the caller
to wrap an integer into a string).

This second patch makes '__bcb_set' available for internal needs.

No functional change intended.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agocmd: bcb: Extract '__bcb_load' from 'do_bcb_load' for internal needs
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:19 +0000 (11:52 +0300)]
cmd: bcb: Extract '__bcb_load' from 'do_bcb_load' for internal needs

Enriching the functionality of U-Boot 'bcb' may assume using the
existing sub-commands as building blocks for the next ones.

A clean way to achive the above is to expose a number of static
routines, each mapped to an existing user command (e.g. load/set/store),
with a user/caller-friendly prototype (i.e. do not force the caller
to wrap an integer into a string).

This first patch makes '__bcb_load' available for internal needs.

No functional change, except for a tiny update in error handling.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agogadget: f_thor: fix wrong file size cast
Seung-Woo Kim [Fri, 16 Oct 2020 07:29:02 +0000 (16:29 +0900)]
gadget: f_thor: fix wrong file size cast

Casting 32bit int value directly into 64bit unsigned type causes
wrong value for file size equal or larger than 2GB. Fix the wrong
file size by casting uint32_t first.

Fixes: commit 1fe9ae76b113 ("gadget: f_thor: update to support more than 4GB file as thor 5.0")
Reported-by: Junghoon Kim <jhoon20.kim@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agodfu: Fix handling of UBI partitions in MTD backend
Guillermo Rodriguez [Wed, 2 Sep 2020 11:06:06 +0000 (13:06 +0200)]
dfu: Fix handling of UBI partitions in MTD backend

For UBI partitions ("partubi" in dfu_alt_info), dfu_fill_entity_mtd sets
the mtd.ubi flag; however other functions incorrectly check for nand.ubi
instead. Fix this by checking for the correct flag.

Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoconfigs: Resync with savedefconfig
Tom Rini [Fri, 29 Jan 2021 18:56:04 +0000 (13:56 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch '2021-01-29-assorted-fixes'
Tom Rini [Fri, 29 Jan 2021 18:50:06 +0000 (13:50 -0500)]
Merge branch '2021-01-29-assorted-fixes'

- Assorted test fixes
- Assorted minor FAT fixes
- Assorted Kconfig dependency fixes
- MediaTek, vexpress_aemv8a improvements
- Other assorted minor fixes

3 years agocmd: add more implementation IDs to sbi command
Heinrich Schuchardt [Tue, 19 Jan 2021 19:44:45 +0000 (19:44 +0000)]
cmd: add more implementation IDs to sbi command

Additional SBI implementation IDs have been added to the upcoming
next version of the SBI specification.

https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agotest: inconsistent string tests
Heinrich Schuchardt [Sun, 17 Jan 2021 23:17:34 +0000 (00:17 +0100)]
test: inconsistent string tests

Excluding ut str in test/cmd_ut.c but compiling test/str_ut.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_str_upper]

Allow to compile test/str_ut.c on all boards.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: inconsistent bootm tests
Heinrich Schuchardt [Sun, 17 Jan 2021 23:17:33 +0000 (00:17 +0100)]
test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: sf: cosmetic: remove unnecessary space
Patrick Delaunay [Mon, 4 Jan 2021 13:41:31 +0000 (14:41 +0100)]
env: sf: cosmetic: remove unnecessary space

Remove the unnecessary space before the 2 "done:" labels
in env_sf_save().

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agotest: Update test_fs to not use deprecated pytest.yield_fixture()
Tom Rini [Thu, 28 Jan 2021 19:39:56 +0000 (14:39 -0500)]
test: Update test_fs to not use deprecated pytest.yield_fixture()

As noted in comments, yield_fixture has been deprecated for longer than
our minimum required version of pytest.  Newer versions of pytest cause
this to be a louder warning, and as the migration is trivial, perform it
now.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agotest: correct entry point to pytest
Heinrich Schuchardt [Thu, 28 Jan 2021 11:46:11 +0000 (12:46 +0100)]
test: correct entry point to pytest

With Pytest 6.0.2 'make tests' fails:

sandbox: Traceback (most recent call last):
  File "./test/py/test.py", line 20, in <module>
    sys.exit(load_entry_point('pytest', 'console_scripts', 'pytest')(args))
TypeError: console_main() takes 0 positional arguments but 1 was given

The definition of console_scripts has changed as follows:

Pytest 4.6.1:

[options.entry_points]
console_scripts =
        pytest=pytest:main
        py.test=pytest:main
        
Pytest 6.0.2:
        
[options.entry_points]
console_scripts =
    pytest=pytest:console_main
    py.test=pytest:console_main

The new function console_main() has a comment:
"This function is not meant for programmable use; use `main()`"

Hence let's call pytest.main() directly.
Move args processing into the __main__ paragraph.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Tom Rini <trini@konsulko.com>
3 years agotest: pr_cont_test.o depends on CONFIG_LOG=y
Heinrich Schuchardt [Wed, 27 Jan 2021 11:09:46 +0000 (12:09 +0100)]
test: pr_cont_test.o depends on CONFIG_LOG=y

Compiling wandboard_defconfig with CONFIG_UT_LOG=y leads to a build error:

test/log/pr_cont_test.c: In function ‘log_test_pr_cont’:
test/log/pr_cont_test.c:28:14: error:
‘gd_t’ {aka ‘volatile struct global_data’} has no member named ‘log_fmt’
  log_fmt = gd->log_fmt;

We do not want to let CONFIG_UT_LOG depend on CONFIG_LOG=y because we have
tests for logging functions called with CONFIG_LOG=n.

Fix the build dependency.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: btrfs: Select SHA256 in Kconfig
Matthias Brugger [Wed, 27 Jan 2021 09:42:30 +0000 (10:42 +0100)]
fs: btrfs: Select SHA256 in Kconfig

Since commit 565a4147d17a ("fs: btrfs: Add more checksum algorithms")
btrfs uses the sha256 checksum algorithm. But Kconfig lacks to select
it. This leads to compilation errors:
fs/built-in.o: In function `hash_sha256':
fs/btrfs/crypto/hash.c:25: undefined reference to `sha256_starts'
fs/btrfs/crypto/hash.c:26: undefined reference to `sha256_update'
fs/btrfs/crypto/hash.c:27: undefined reference to `sha256_finish'

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
3 years agofs: fat: remove superfluous assignments
Heinrich Schuchardt [Mon, 25 Jan 2021 23:14:14 +0000 (00:14 +0100)]
fs: fat: remove superfluous assignments

Do not assign a value to a variable if it is not used.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: avoid out of bounds access warning
Heinrich Schuchardt [Mon, 25 Jan 2021 23:04:19 +0000 (00:04 +0100)]
fs: fat: avoid out of bounds access warning

When copying short name plus extension refer to the encapsulating structure
and not to the short name element.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoavb: AVB_VERIFY depends on MMC
Heinrich Schuchardt [Mon, 25 Jan 2021 11:17:57 +0000 (12:17 +0100)]
avb: AVB_VERIFY depends on MMC

AVB Verified Boot uses functions related to MMC.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>
3 years agovexpress_aemv8a: allow overriding BOOTCOMMAND
Stanislav Pinchuk [Wed, 20 Jan 2021 18:54:53 +0000 (21:54 +0300)]
vexpress_aemv8a: allow overriding BOOTCOMMAND

Re-send because of line-wraps.

This patch fixes the behaviour of the menuconfig's BOOTCOMMAND
setting. Which is just ignored without that patch on
vexpress_aemv8a platform.

Signed-off-by: Stanislav.Pinchuk@kaspersky.com
3 years agoarm: dts: enable MTK SPI NOR controller driver
SkyLake.Huang [Wed, 20 Jan 2021 07:31:34 +0000 (15:31 +0800)]
arm: dts: enable MTK SPI NOR controller driver

1. Enable MTK SPI NOR controller driver on mt7622 & mt7629.
2. Enable quad mode for read and single mode for write.

Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
3 years agospi: mtk_snor: add support for MTK SPI NOR controller
SkyLake.Huang [Wed, 20 Jan 2021 07:31:33 +0000 (15:31 +0800)]
spi: mtk_snor: add support for MTK SPI NOR controller

This patch adds support for MTK SPI NOR controller, which you
can see on mt7622 & mt7629.

1. This controller is designed only for SPI NOR. We can't adjust
its bus clock dynamically. Set clock in dts instead.
2. This controller only supports 1-1-1 write mode.
3. Remove mtk_snor_match_read() since upper SPI-MEM layer already
handles command.
4. sf read/write/update commands are tested with this driver.

Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
3 years agotest: test_ofplatdata: Mark as sandbox specific
Tom Rini [Tue, 19 Jan 2021 19:40:10 +0000 (14:40 -0500)]
test: test_ofplatdata: Mark as sandbox specific

This test checks for output specific to the sandbox device tree, mark it
as sandbox specific.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch '2021-01-27-assorted-fixes-and-improvements'
Tom Rini [Thu, 28 Jan 2021 16:37:58 +0000 (11:37 -0500)]
Merge branch '2021-01-27-assorted-fixes-and-improvements'

- A wide variety of fixes throughout the tree.

3 years agocmd: misc: Fix return value for the sleep command
Marek Szyprowski [Fri, 22 Jan 2021 11:27:31 +0000 (12:27 +0100)]
cmd: misc: Fix return value for the sleep command

If sleeping has been interrupted, return CMD_RET_FAILURE instead of -1
(CMD_RET_USAGE).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agodoc: device-tree-bindings: rtc: Abracon AB x80x i2c rtc
Ying-Chun Liu (PaulLiu) [Fri, 15 Jan 2021 05:53:03 +0000 (13:53 +0800)]
doc: device-tree-bindings: rtc: Abracon AB x80x i2c rtc

Document the bindings for abracon,abx80x and related compatibles.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
3 years agortc: add rtc-abx80x, a driver for the Abracon AB x80x i2c rtc
Ying-Chun Liu (PaulLiu) [Fri, 15 Jan 2021 05:53:02 +0000 (13:53 +0800)]
rtc: add rtc-abx80x, a driver for the Abracon AB x80x i2c rtc

This is a basic driver for the ultra-low-power Abracon AB x80x series
of RTC chips. It supports in particular, the supersets AB0805 and AB1805.
It allows reading and writing the time, and enables the supercapacitor or
battery charger.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
3 years agoautoboot: fix illegal memory access when stop key and delay key are empty
Yuezhang.Mo@sony.com [Fri, 15 Jan 2021 03:11:49 +0000 (03:11 +0000)]
autoboot: fix illegal memory access when stop key and delay key are empty

If both stop key and delay key are empty, the length of these
keys is 0. The subtraction operation will cause the u_int type
variable to overflow, will cause illegal memory access in key
input loop.

This commit fixes this bug by using int type instead of u_init.
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agobinman: Allow reading entries from a subnode
Simon Glass [Thu, 14 Jan 2021 03:29:57 +0000 (20:29 -0700)]
binman: Allow reading entries from a subnode

Some images may have multiple copies of the same thing, e.g. two versions
of the read/write U-Boots. It is necessary to read data from one or other
of these under selection of the verified-boot logic. Add a function to
select the subnode to use.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Move selection of the binman node into a function
Simon Glass [Thu, 14 Jan 2021 03:29:56 +0000 (20:29 -0700)]
binman: Move selection of the binman node into a function

Move this logic out of the main init function so it is available for
other purpose.

Use a different error when multiple-images is in use but no subnode is
available. This makes it easier to determine what is wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocrc32: Exclude crc32 from TPL
Simon Glass [Thu, 14 Jan 2021 03:29:55 +0000 (20:29 -0700)]
crc32: Exclude crc32 from TPL

Unfortunately the toolchain often brings in the crc32 table even if the
function is not actually used. For now, exclude it from the TPL build,
which is very sensitive to size.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agommc: pci_mmc: Set the removable flag
Simon Glass [Thu, 14 Jan 2021 03:29:54 +0000 (20:29 -0700)]
mmc: pci_mmc: Set the removable flag

Set this flag so that it is available to those looking at the device. For
non-removable devices there is no need to check for insertion/removable
since the media can never change.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: pci_mmc: Only generate ACPI code for the SD card
Simon Glass [Thu, 14 Jan 2021 03:29:52 +0000 (20:29 -0700)]
mmc: pci_mmc: Only generate ACPI code for the SD card

At present if an eMMC part is in the system, the ACPI table generated
will include information about that, as well as the SD card. We only need
to include the SD card, since it has a card-detect GPIO. Use a different
compatible string for each option, and add code only for the SD card.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agouuid: Add a comment for UUID_STR_LEN
Simon Glass [Thu, 14 Jan 2021 03:29:51 +0000 (20:29 -0700)]
uuid: Add a comment for UUID_STR_LEN

This macro is the length of the string but excludes the terminator. Users
must add 1 when declaring a large-enough string. Add a comment to make
this clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodisplay_options: Use USE_TINY_PRINTF for SPL check
Simon Glass [Thu, 14 Jan 2021 03:29:50 +0000 (20:29 -0700)]
display_options: Use USE_TINY_PRINTF for SPL check

At present this code uses a simple printf() format if running in SPL. But
SPL can use the full printf. Use USE_TINY_PRINTF instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agofdtdec: Use CONFIG_IS_ENABLED in board_fdt_blob_setup()
Simon Glass [Thu, 14 Jan 2021 03:29:49 +0000 (20:29 -0700)]
fdtdec: Use CONFIG_IS_ENABLED in board_fdt_blob_setup()

This setting may be different in SPL and TPL. Update the code to check
the correct setting.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agofdtdec: Update the missing-devicetree message
Simon Glass [Thu, 14 Jan 2021 03:29:48 +0000 (20:29 -0700)]
fdtdec: Update the missing-devicetree message

This includes information about sandbox which is not relevant for most
boards. Drop it.

Also add the address to help figure out the problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agonet: Use CONFIG_IS_ENABLED() in eth_dev_get_mac_address()
Simon Glass [Thu, 14 Jan 2021 03:29:47 +0000 (20:29 -0700)]
net: Use CONFIG_IS_ENABLED() in eth_dev_get_mac_address()

This function may be used in SPL where devicetree is not available.
Use the correct macro so that the function does not try to read it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agovideo: Allow syncing the entire framebuffer to the copy
Simon Glass [Thu, 14 Jan 2021 03:29:46 +0000 (20:29 -0700)]
video: Allow syncing the entire framebuffer to the copy

In some cases so much of the framebuffer is updated that it is not worth
copying the changes piece by piece to the copy framebuffer. Add a function
to copy the whole thing.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobloblist: Add missing tag names
Simon Glass [Thu, 14 Jan 2021 03:29:44 +0000 (20:29 -0700)]
bloblist: Add missing tag names

Add tag names for recently added types.

Fixes: d2cb7a22da0 (x86: Allow putting some tables in the bloblist)
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobloblist: Support relocating to a larger space
Simon Glass [Thu, 14 Jan 2021 03:29:43 +0000 (20:29 -0700)]
bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospl: Add functions for next and previous phase
Simon Glass [Thu, 14 Jan 2021 03:29:42 +0000 (20:29 -0700)]
spl: Add functions for next and previous phase

It is useful to be able to figure out which phase we are loading next and
which phase we came from. Add some functions to handle this as well as
returning the name of a phase. This allows messages like "Booting to x"
where x is the next phase.

At present, TPL says 'Jumping to U-Boot' at the end, when in fact it is
jumping to SPL. This is confusing, so use the new functions to correct
this.

Tests for this will come with an upcoming minor SPL test refactor.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agolib: rsa: rsa-verify: don't look for keys in the FIT image
Philippe Reynes [Tue, 12 Jan 2021 18:18:54 +0000 (19:18 +0100)]
lib: rsa: rsa-verify: don't look for keys in the FIT image

In the function rsa_verify_hash, if the "main" key doesn't
work, u-boot try others keys. But it searches those keys
in the FIT image instead of the u-boot device tree.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopci: Remove CONFIG_PCI_ENUM_ONLY as it's not used (any more)
Stefan Roese [Tue, 12 Jan 2021 11:03:43 +0000 (12:03 +0100)]
pci: Remove CONFIG_PCI_ENUM_ONLY as it's not used (any more)

This patch completely removes CONFIG_PCI_ENUM_ONLY from the PCI code as
it is not configured for any board (any more). With this removal, some
PCI related files get cleaned up a bit.

Additional, dm_pciauto_setup_device() is now static, as it's not
referenced from any code outside of this C file.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: fit-sig: Fix error message in fit_config_verify_sig()
Alexandru Gagniuc [Mon, 11 Jan 2021 14:46:58 +0000 (08:46 -0600)]
common: fit-sig: Fix error message in fit_config_verify_sig()

In fit_config_verify_sig(), when no 'signature*' subnode exists in
the configuration node, the fdt_for_each_subnode() loop is a no-op.
Therefore, no error flags are set, and 'err_,sg' is not populated
with an error string. This is incorrect behavior.

Populate err_msg to indicate that no 'signature' is found, before
entering the loop. The first call to fit_image_verify_sig() will
override clear err_msg, or set it to a more specific message.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosmccc: fix sign bit expansion
Volodymyr Babchuk [Tue, 5 Jan 2021 20:03:11 +0000 (20:03 +0000)]
smccc: fix sign bit expansion

Signed ARM_SMCCC_FAST_CALL value is shifted to 31'st bit. Then, it is expanded
to 64 bit value, which results in 1s in higher 32 bits.

This causes corrupted values in 64-bit SMC IDs and issues in buggy handlers of
32-bit calls.

We need to make ARM_SMCCC_FAST_CALL unsigned long, so it would work properly
on 32 bit architectures.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
3 years agobootcount: allow to use this feature on TPL
Philippe Reynes [Fri, 11 Dec 2020 18:56:47 +0000 (19:56 +0100)]
bootcount: allow to use this feature on TPL

This commit add an option TPL_BOOTCOUNT_LIMIT to
use bootcount on TPL.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMakefile: Do not call useless command 'true'
Pali Rohár [Wed, 4 Nov 2020 14:33:44 +0000 (15:33 +0100)]
Makefile: Do not call useless command 'true'

Macro 'cmd_objcopy_uboot' currently does not work with passed empty command
expanded from 'cmd_static_rela' and therefore dummy command 'true' is set
in 'cmd_static_rela' to workaround this issue.

Eliminate it now by fixing 'cmd_objcopy_uboot' macro to work also with
empty 'cmd_static_rela' macro and remove useless invocation of command
'true'.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Wed, 27 Jan 2021 16:39:31 +0000 (11:39 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell

- Espressobin: Disable slot when emmc is not present (Pali)
- DS414; config header cleanup (Phil)
- PCI: auto-config enhancement (Phil)
- pci_mvebu: Also map IO region (Phil)
- serial: a3720: Implement pending method for output direction (Pali)
- turris_mox: Enable a few commands (Marek)
- helios4 & ClearFog changes (Dennis)
- Plus some minor misc changes

3 years agoMerge tag 'doc-2021-04-rc1-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Wed, 27 Jan 2021 16:32:23 +0000 (11:32 -0500)]
Merge tag 'doc-2021-04-rc1-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for documentation tag doc-2021-04-rc1-3

Update the build system for the HTML documentation to allow using
Sphinx 3.

Man-page for exception command.

3 years agoMerge branch '2021-01-27-assorted-net-updates'
Tom Rini [Wed, 27 Jan 2021 16:30:31 +0000 (11:30 -0500)]
Merge branch '2021-01-27-assorted-net-updates'

- e1000 fixes for MIPS
- netconsole and ping fix
- cortina_ni driver
- micrel PHY fix
- Add fdtoverlays keyword to extlinux file parsing

3 years agocmd: pxe: add support for FDT overlays
Neil Armstrong [Wed, 20 Jan 2021 08:54:53 +0000 (09:54 +0100)]
cmd: pxe: add support for FDT overlays

This adds support for specifying FDT overlays in an extlinux/pxelinux
configuration file.

Without this, there is no simple way to apply overlays when the kernel
and fdt is loaded by the pxe command.

This change adds the 'fdtoverlays' keyword for a label, supporting multiple
overlay files to be applied on top of the fdt specified in the 'fdt' or
'devicetree' keyword.

Example:
  label linux
    kernel /Image
    fdt /soc-board.dtb
    fdtoverlays /soc-board-function.dtbo
    append console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait

This code makes usage of a new variable called fdtoverlay_addr_r used to load
the overlay files without overwritting anything important.

Cc: Tom Rini <trini@konsulko.com>
Cc: Andre Heider <a.heider@gmail.com>
Cc: Jernej Škrabec <jernej.skrabec@siol.net>
Cc: Jonas Karlman <jonas@kwiboo.se>
Tested-by: Jernej Škrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Škrabec <jernej.skrabec@siol.net>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agonet: phy: micrel: Try default PHY ofnode first
Marek Vasut [Sat, 16 Jan 2021 23:16:16 +0000 (00:16 +0100)]
net: phy: micrel: Try default PHY ofnode first

The phydev structure has a PHY OF node pointer in it, use that OF node
first when looking up PHY OF node properties, since that is likely the
correct PHY OF node pointer. If the pointer is not valid, which is the
case e.g. on legacy DTs, fall back to parsing MAC ethernet-phy subnode.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
3 years agoboard: presidio-asic: Add CAxxxx Ethernet support
Alex Nemirovsky [Thu, 14 Jan 2021 21:34:13 +0000 (13:34 -0800)]
board: presidio-asic: Add CAxxxx Ethernet support

Add CAxxxx Ethernet support for the Cortina Access
Presidio Engineering Board

Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
CC: Tom Rini <trini@konsulko.com>
3 years agonet: phy: ca_phy: Add driver for CAxxxx SoCs
Abbie Chang [Thu, 14 Jan 2021 21:34:12 +0000 (13:34 -0800)]
net: phy: ca_phy: Add driver for CAxxxx SoCs

Add phy driver support for MACs embedded inside Cortina Access SoCs

Signed-off-by: Abbie Chang <abbie.chang@cortina-access.com>
Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Tom Rini <trini@konsulko.com>
CC: Aaron Tseng <aaron.tseng@cortina-access.com>
Moved out PHY specific code out of Cortina NI Ethernet driver
and into a Cortina Access PHY interface driver

3 years agonet: cortina_ni: Add eth support for Cortina Access CAxxxx SoCs
Aaron Tseng [Thu, 14 Jan 2021 21:34:11 +0000 (13:34 -0800)]
net: cortina_ni: Add eth support for Cortina Access CAxxxx SoCs

Add Cortina Access Ethernet device driver for CAxxxx SoCs.
This driver supports both legacy and DM_ETH network models.

Signed-off-by: Aaron Tseng <aaron.tseng@cortina-access.com>
Signed-off-by: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
Signed-off-by: Abbie Chang <abbie.chang@cortina-access.com>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Abbie Chang <abbie.chang@Cortina-Access.com>
CC: Tom Rini <trini@konsulko.com>
3 years agonet: fix ping in netconsole
Yang Liu [Mon, 21 Dec 2020 03:44:39 +0000 (14:44 +1100)]
net: fix ping in netconsole

Should not init eth device when doing ping in netconsole.

Signed-off-by: Yang Liu <yliu@cybertec.com.au>
Cc: Joe Hershberger <joe.hershberger@ni.com>
3 years agonet: e1000: Add missing address translations
Stefan Roese [Mon, 16 Nov 2020 17:02:30 +0000 (18:02 +0100)]
net: e1000: Add missing address translations

Add some missing address translations from virtual address in local DRAM
to physical address, which is needed for the DMA transactions to work
correctly.

This issue was detected while testing the e1000 driver on the MIPS
Octeon III platform, which needs address translation.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
3 years agonet: e1000: Use virt_to_phys() instead of pci_virt_to_mem()
Stefan Roese [Mon, 16 Nov 2020 17:02:29 +0000 (18:02 +0100)]
net: e1000: Use virt_to_phys() instead of pci_virt_to_mem()

Using (dm_)pci_virt_to_mem() is incorrect to translate the virtual
address in local DRAM to a physical address. The correct macro here
is virt_to_phys() so switch to using this macro.

As virt_to_bus() is now not used any more, this patch also removes
both definitions (DM and non-DM).

This issue was detected while testing the e1000 driver on the MIPS
Octeon III platform, which needs address translation.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
3 years agonet: e1000: Remove unused bus_to_phys() macro
Stefan Roese [Mon, 16 Nov 2020 17:02:28 +0000 (18:02 +0100)]
net: e1000: Remove unused bus_to_phys() macro

bus_to_phys() is defined but not referenced at all. This patch removes
it completely.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
3 years agoarm: mvebu: turris_mox: enable setexpr command in defconfig
Marek Behún [Tue, 19 Jan 2021 14:49:26 +0000 (15:49 +0100)]
arm: mvebu: turris_mox: enable setexpr command in defconfig

Enable setexpr command in defconfig for Turris MOX. We have found that
this is sometimes useful in U-Boot scripts and there is enough space in
NOR memory on MOX.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: mvebu: turris_mox: enable wdt command in defconfig
Marek Behún [Tue, 19 Jan 2021 14:49:25 +0000 (15:49 +0100)]
arm: mvebu: turris_mox: enable wdt command in defconfig

Enable wdt command in defconfig for Turris MOX. This is useful when
doing debugging.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm64: a37xx: pci: Fix printing debug messages
Pali Rohár [Mon, 18 Jan 2021 11:09:33 +0000 (12:09 +0100)]
arm64: a37xx: pci: Fix printing debug messages

Value pcie->dev in function pcie_advk_probe() is not initialized yet
so use dev as argument for dev_dbg()/dev_warn().

Function pcie_advk_wait_pio() itself prints error message on failure
so do not print duplicate error message in caller.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoserial: a3720: Implement pending method for output direction
Pali Rohár [Thu, 14 Jan 2021 14:46:35 +0000 (15:46 +0100)]
serial: a3720: Implement pending method for output direction

To check if some output characters are waiting either in Transmitter
Holding Register or Transmitter Shift Register we need to look at
TX_EMPTY bit of UART Status Register.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agodoc: exception command
Heinrich Schuchardt [Tue, 26 Jan 2021 11:59:09 +0000 (12:59 +0100)]
doc: exception command

Create man-page for exception command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: update Kernel documentation build system
Heinrich Schuchardt [Thu, 31 Dec 2020 22:16:46 +0000 (23:16 +0100)]
doc: update Kernel documentation build system

Update the documentation build system according to Linux v5.11-rc1.

Deactive the automarkup.py extension module which on Gitlab CI is
incompatible with Unicode.

With this patch we can build the HTML documentation using either of
Sphinx 2 and Sphinx 3.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years ago.gitlab-ci: install doc/sphinx/requirements.txt
Heinrich Schuchardt [Mon, 25 Jan 2021 21:06:25 +0000 (22:06 +0100)]
.gitlab-ci: install doc/sphinx/requirements.txt

Install all requirements according to doc/sphinx/requirements.txt in the
virtual environment used for testing 'make htmldocs'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: fix doc/develop/logging.rst
Heinrich Schuchardt [Mon, 25 Jan 2021 20:06:57 +0000 (21:06 +0100)]
doc: fix doc/develop/logging.rst

Sphinx 3 builds fail due to doc/develop/logging.rst producing duplicate
labels.

Include logging.h only once in the API section and use cross-references for
the enums log_level_t and log_category_t.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: board: fix Microchip MPFS Icicle Kit doc
Heinrich Schuchardt [Mon, 25 Jan 2021 19:11:54 +0000 (20:11 +0100)]
doc: board: fix Microchip MPFS Icicle Kit doc

Two sibling headings (here eMMC) cannot have the same title.

Warning, treated as error:
doc/board/microchip/mpfs_icicle.rst:423:duplicate label
board/microchip/mpfs_icicle:emmc, other instance in
doc/board/microchip/mpfs_icicle.rst
make[1]: *** [doc/Makefile:69: htmldocs] Error 2

* Correct the heading levels.
* Add missing empty lines after headings.

Fixes: 9e550e18305f ("doc: board: Add Microchip MPFS Icicle Kit doc")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agopci: pci_mvebu: Define an IO region as well
Phil Sutter [Sun, 3 Jan 2021 22:06:46 +0000 (23:06 +0100)]
pci: pci_mvebu: Define an IO region as well

Configure an IO region and window for PNP identical to how MEM region is
set up. Linux does this only if the DT defines a pcie-io-aperture
property for the SOC, but since all supported boards do this should not
be needed.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agopci: Make auto-config code a little more robust
Phil Sutter [Sun, 3 Jan 2021 22:06:45 +0000 (23:06 +0100)]
pci: Make auto-config code a little more robust

On my DS414, some PCI devices return odd values when probing BAR sizes.
An obvious case is all-ones response, the Linux driver
(drivers/pci/probe.c) catches those explicitly and a comment explains
that either bit 0 or bit 1 must be clear (depending on MEM or IO type).
Other BARs return e.g. 0xfff0000f or 0xfff00004 and thus manage to break
size calculation due to the "middle" zeroes. Mitigate that copying more
or less what Linux does and do a "find least bit set".

Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: mvebu: ds414: Config header mini-review
Phil Sutter [Sun, 3 Jan 2021 22:06:44 +0000 (23:06 +0100)]
arm: mvebu: ds414: Config header mini-review

A few minor changes:

* Get rid of leftover comments, other commits removed the defines they
  referred to.

* CONFIG_SYS_NETA_INTERFACE_TYPE is not used anymore since commit
  e3b9c98a23ca9 ("net: mvneta: Convert to driver model").

* Drop CONFIG_USB_MAX_CONTROLLER_COUNT: it is per-HCI type, so XHCI and
  EHCI could still both work be used.

* Unconditionally define CONFIG_EHCI_IS_TDI: it has no effect on XHCI so
  that conditional doesn't make any sense.

* Define a larger PHY_ANEG_TIMEOUT: In my test bed, the NIC is directly
  connected to some RTL8111 and the default 8s timeout was often too
  short.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: mvebu: Espressobin: Disable slot when emmc is not present
Pali Rohár [Mon, 21 Dec 2020 10:09:10 +0000 (11:09 +0100)]
arm: mvebu: Espressobin: Disable slot when emmc is not present

This change extends previous commit 061c6d1b238a ("arm: mvebu: Espressobin:
Detect presence of emmc at runtime") and when emmc is not present then emmc
is removed from U-Boot DM and corresponding slot is disabled. Therefore on
Espressobin board without soldered emmc, state of emmc hw should be same as
if emmc was disabled in DTS.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoARM: mvebu: ClearFog make sure that SATA and UART images are buildable
Dennis Gilmore [Wed, 9 Dec 2020 03:07:38 +0000 (21:07 -0600)]
ARM: mvebu: ClearFog make sure that SATA and UART images are buildable

SATA and UART ClearFog imaages are not buildable as ENV_SECT_SIZE is not defined
set values for both possible targets

Signed-off-by: Dennis Gilmore <dennis@ausil.us>