pandora-u-boot.git
3 years agoPrepare v2021.04-rc1 v2021.04-rc1
Tom Rini [Mon, 1 Feb 2021 15:28:20 +0000 (10:28 -0500)]
Prepare v2021.04-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Mon, 1 Feb 2021 13:15:46 +0000 (08:15 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86

- Fix CMD_ACPI dependency in Kconfig
- Correct overflow in __udelay() in TSC timer driver
- Add a devicetree node for eMMC for Coral
- Minor improvements on image loading
- Reduce size of Samus image

3 years agox86: Reduce size of samus image
Simon Glass [Sun, 31 Jan 2021 16:17:07 +0000 (09:17 -0700)]
x86: Reduce size of samus image

With the recent addition of ACPI generation, the image size has got beyond
its current limit.

Samus does not actually use this, nor x86 emulation for PCI ROMs, so
disable both features.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: tpl: Show next stage being booted
Simon Glass [Sun, 24 Jan 2021 17:06:11 +0000 (10:06 -0700)]
x86: tpl: Show next stage being booted

Enhance the debugging to show the next stage being booted as well as a
dump of the start of the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: spl: Clear BSS unconditionally
Simon Glass [Sun, 24 Jan 2021 17:06:10 +0000 (10:06 -0700)]
x86: spl: Clear BSS unconditionally

This should be done even if not using TPL, since BSS may be in use or
boards that only use SPL. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: zimage: Improve command-line debug handling
Simon Glass [Sun, 24 Jan 2021 17:06:09 +0000 (10:06 -0700)]
x86: zimage: Improve command-line debug handling

At present if the command line is very long it is truncated by the
printf() statement, which works within a limited buffer. Use puts()
instead. Also show better debugging with the command-line setup
fails.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: zimage: Allow dumping the image from outside the module
Simon Glass [Sun, 24 Jan 2021 17:06:08 +0000 (10:06 -0700)]
x86: zimage: Allow dumping the image from outside the module

At present it is possible to dump an image within the zimage command, but
it is also useful to be able to dump it from elsewhere, for example in a
loader that has special handling for the different zimage stages.

Export this feature as a new function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: Update Chromium OS GNVS names
Simon Glass [Sun, 24 Jan 2021 17:06:07 +0000 (10:06 -0700)]
x86: Update Chromium OS GNVS names

The Global Non-Volatile Storage struct has some fields with particular
meanings. Rename these to make things easier to follow. Also add a few
more boot flags.

GNVS should not be confused with GNVQ (Going Nowhere Very Quickly).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: spl: Make moving BSS conditional
Simon Glass [Sun, 24 Jan 2021 17:06:06 +0000 (10:06 -0700)]
x86: spl: Make moving BSS conditional

At present BSS is always placed in SDRAM. If a separate BSS is not in use
this means that BSS doesn't work as expected. Make the setting conditional
on the SEPARATE_BSS option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: Make sure the SPL image ends on a suitable boundary
Simon Glass [Sun, 24 Jan 2021 17:06:05 +0000 (10:06 -0700)]
x86: Make sure the SPL image ends on a suitable boundary

The part of U-Boot that actually ends up in u-boot-nodtb.bin is not built
with any particular alignment. It ends at the start of the BSS section.
The BSS section selects its own alignment, which may larger.
This means that there can be a gap of a few bytes between the image
ending and BSS starting.

Since u-boot.bin is build by joining u-boot-nodtb.bin and u-boot.dtb (with
perhaps some padding for BSS), the expected result is not obtained. U-Boot
uses the end of BSS to find the devicetree, so this means that it cannot
be found.

Add 32-byte alignment of BSS so that the image size is correct and
appending the devicetree will place it at the end of BSS.

Example SPL output without this patch:

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         000142a1  fef40000  fef40000  00001000  2**4
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .u_boot_list  000014a4  fef542a8  fef542a8  000152a8  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
  2 .rodata       0000599c  fef55760  fef55760  00016760  2**5
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  3 .data         00000970  fef5b100  fef5b100  0001c100  2**5
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
  4 .binman_sym_table 00000020  fef5ba70  fef5ba70  0001ca70  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  5 .bss          00000060  fef5baa0  fef5baa0  00000000  2**5
                  ALLOC

You can see that .bss is aligned to 2**5 (32 bytes). This is because of
the mallinfo struct in dlmalloc.c:

 17 .bss.current_mallinfo 00000028  00000000  00000000  000004c0  2**5
                  ALLOC

In this case the size of u-boot-spl-nodtb.bin is 0x1ba90. This matches up
with the _image_binary_end symbol:

fef5ba90 g       .binman_sym_table      00000000 _image_binary_end

But BSS starts 16 bytes later, at 0xfef5baa0, due to the 32-byte
alignment. So we must align _image_binary_end to a 32-byte boundary. This
forces the binary size to be 0x1baa0, i.e. ending at the start of bss, as
expected.

Note that gcc reports __BIGGEST_ALIGNMENT__ of 16 on this build, even
though it generates an object file with a member that requests 32-byte
alignment.

The current_mallinfo struct is 40 bytes in size. Increasing the struct to
68 bytes (i.e. just above a 64-byte boundary) does not cause the alignment
to go above 32 bytes. So it seems that 32 bytes is the maximum alignment
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: add more details in the commit message to help people understand]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: apl: Enhance debugging in the SPL loader
Simon Glass [Sun, 24 Jan 2021 17:06:04 +0000 (10:06 -0700)]
x86: apl: Enhance debugging in the SPL loader

Move to log_debug() and make use of the new SPL function to find the
text base.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: spl: Add a function to find the text base
Simon Glass [Sun, 24 Jan 2021 17:06:03 +0000 (10:06 -0700)]
x86: spl: Add a function to find the text base

It is useful to know the TEXT_BASE value for the image being loaded in
TPL/SPL. Add a new spl_get_image_text_base() function to handle this.

Make use of this in the x86 SPL handler, instead of having the logic
there.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: acpi_gpe: Update driver name to match devicetree
Simon Glass [Sun, 24 Jan 2021 17:06:02 +0000 (10:06 -0700)]
x86: acpi_gpe: Update driver name to match devicetree

Use a driver name in line with the compatible string so that of-platdata
can use this driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoacpi: Tidy up documentation for struct acpi_gpio
Simon Glass [Sat, 23 Jan 2021 18:08:38 +0000 (11:08 -0700)]
acpi: Tidy up documentation for struct acpi_gpio

Some comments were provided after this patch was applied. Address them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: coral: Add a devicetree node for eMMC
Simon Glass [Thu, 14 Jan 2021 03:29:53 +0000 (20:29 -0700)]
x86: coral: Add a devicetree node for eMMC

Add a node for this so we can indicate that it is does not require any
ACPI code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: tsc_timer: Correct overflow in __udelay()
Simon Glass [Thu, 14 Jan 2021 03:29:45 +0000 (20:29 -0700)]
x86: tsc_timer: Correct overflow in __udelay()

At present long delays such as msleep(2000) can cause an overflow in this
function. There is no need for this, since it already uses a 64-bit int.

Add a cast to correct this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agocmd: CMD_ACPI depends on ACPIGEN
Heinrich Schuchardt [Wed, 20 Jan 2021 20:37:56 +0000 (21:37 +0100)]
cmd: CMD_ACPI depends on ACPIGEN

Trying to compile qemu-x86_64_defconfig with CONFIG_CMD_ACPI=y and
CONFIG_ACPIGEN=n fails with

ld.bfd: cmd/built-in.o: in function `do_acpi_items':
cmd/acpi.c:162: undefined reference to `acpi_dump_items'

Add the missing configuration dependency.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Mon, 1 Feb 2021 00:44:45 +0000 (19:44 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi

- Allwinner H616 Ethernet support
- sunxi ata debug fix

3 years agoata: sunxi: fix debug messages
Dario Binacchi [Sun, 24 Jan 2021 18:13:10 +0000 (19:13 +0100)]
ata: sunxi: fix debug messages

It is useless and misleading to print the ret variable that is not set
by the dev_read_addr routine. Also, move the '\n' character after the
round bracket that contains the error code.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: OrangePi Zero 2: Enable Ethernet
Andre Przywara [Sat, 23 Jan 2021 12:46:43 +0000 (12:46 +0000)]
sunxi: OrangePi Zero 2: Enable Ethernet

With the fixes to the sun8i-emac driver, we can now enable Ethernet
support on the OrangePi Zero2.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
3 years agonet: sun8i-emac: Determine pinmux based on SoC, not EMAC type
Andre Przywara [Mon, 11 Jan 2021 20:11:49 +0000 (21:11 +0100)]
net: sun8i-emac: Determine pinmux based on SoC, not EMAC type

The pinmux choice for the RMII/RGMII pins the EMAC is connected to is
not dependent on the EMAC IP, but on the SoC it is integrated in.
Deriving the pinmux from the DT compatible string (as we do at the
moment) will thus cause problems with certain EMAC IP / SoC combinations.

To avoid this exact issue with the H616, let's use our Kconfig MACH
symbols to choose the correct pinmux setup.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
3 years agonet: sun8i-emac: Always clear syscon EPHY register
Andre Przywara [Mon, 11 Jan 2021 20:11:45 +0000 (21:11 +0100)]
net: sun8i-emac: Always clear syscon EPHY register

At the moment we only consider the EPHY register for those SoCs were
we actually have an internal PHY to configure. However even other SoCs
have this register, an expect the EPHY select bit to be cleared for
proper operation with an external PHY.

Rework sun8i_emac_set_syscon_ephy() to be called regardless of the EMAC
model, and clear the H3_EPHY_SELECT bit if no internal PHY is used.

We get away without it so far because SoCs like the A64 clear this bit
on reset, but we need to explicitly clear it on the H616, for instance.
The Linux driver does so as well.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sun, 31 Jan 2021 19:24:35 +0000 (14:24 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

- Assorted gadget changes including:
  - dfu: Fix handling of UBI partitions in MTD backend
  - gadget: f_thor: fix wrong file size cast
  - Extend cmd: bcb
  - Fixes for fastboot and rockchip gadgets
  - dfu: Add SCRIPT and SKIP entities
  - dfu/thor: Add `dfu_alt_info` reinitialization from flashed script
  - u-boot: Reduce size of u-boot as usbd_device_* arrays are not exported

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sun, 31 Jan 2021 19:23:47 +0000 (14:23 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-sh

- Sync r8a774a1 DT files, tmio sdhi DMA fix

3 years agoMerge tag 'dm-pull-30jan21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Sun, 31 Jan 2021 13:49:53 +0000 (08:49 -0500)]
Merge tag 'dm-pull-30jan21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

tpm fixes for coral
binman fixes support for symbols in sub-sections
support for additional cros_ec commands
various minor fixes / tweaks

3 years agousb: gaget: ci: set ep's desc when enable ep
Li Jun [Mon, 25 Jan 2021 13:44:00 +0000 (21:44 +0800)]
usb: gaget: ci: set ep's desc when enable ep

As we need standard usb_ep's desc, so set it when enable ep.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: fastboot: use correct max packet size
Li Jun [Mon, 25 Jan 2021 13:43:59 +0000 (21:43 +0800)]
usb: gadget: fastboot: use correct max packet size

Change to use wMaxPacketSize of current speed EP desc for request
length wrap up.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
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 agommc: tmio: sdhi: Configure internal DMA bus width
Marek Vasut [Sun, 3 Jan 2021 10:38:25 +0000 (11:38 +0100)]
mmc: tmio: sdhi: Configure internal DMA bus width

The R-Car3 SDHI should set these two bits in DMA_MODE register according
to the specification, to indicate 64bit bus width. No other bus width
options are permitted and the default value is 0, which is incorrect.
Set the bits accordingly.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
3 years agoarm: dts: rmobile: r8a774a1: Synchronize DTs with Linux 5.10
Biju Das [Sun, 17 Jan 2021 16:30:11 +0000 (16:30 +0000)]
arm: dts: rmobile: r8a774a1: Synchronize DTs with Linux 5.10

DTS files apart from r8a774a1-hihope-rzg2m-u-boot.dts and
r8a774a1-u-boot.dtsi have been imported from linux 5.10
commit 2c85ebc57b3e1817 ("Linux 5.10").

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
3 years agodisk: part: sandbox support in dev_print()
Heinrich Schuchardt [Mon, 25 Jan 2021 11:57:15 +0000 (12:57 +0100)]
disk: part: sandbox support in dev_print()

Commands like 'fatinfo' call dev_print() to print device information. If
the block device is created via 'host bind', we should print accurate
information.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agosandbox: fill block device meta information
Heinrich Schuchardt [Mon, 25 Jan 2021 11:57:14 +0000 (12:57 +0100)]
sandbox: fill block device meta information

Provide information about host backed block device.

Mark the device created by 'host bind' as removable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodm: replace auto_alloc_size with auto
Dario Binacchi [Sat, 23 Jan 2021 18:48:57 +0000 (19:48 +0100)]
dm: replace auto_alloc_size with auto

The auto_alloc_size members of struct driver has been renamed auto.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodo not pass NULL pointer to libfdt
Stanislav Pinchuk [Wed, 20 Jan 2021 18:52:23 +0000 (21:52 +0300)]
do not pass NULL pointer to libfdt

Re-send because of line-wraps.

Without this patch, u-boot just hangs if the fdt pointer is
not initialized. The diagnostic subsystems are not yet initialized,
so all you get is a blind hang.

Signed-off-by: Stanislav.Pinchuk@kaspersky.com
3 years agosandbox: keep time offset when resetting
Heinrich Schuchardt [Wed, 30 Dec 2020 17:07:48 +0000 (18:07 +0100)]
sandbox: keep time offset when resetting

The UEFI Self Certification Test (SCT) checks the SetTime() service with
the following steps:

* set date
* reset
* check date matches

To be compliant the sandbox should keep the offset to the host RTC during
resets. The implementation uses the environment variable
UBOOT_SB_TIME_OFFSET to persist the offset.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Print a debug message when binman selects a node
Simon Glass [Thu, 21 Jan 2021 20:57:16 +0000 (13:57 -0700)]
binman: Print a debug message when binman selects a node

Add some debugging to indicate which node the binman library is looking
at.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoAdd a symlink for ctype.h
Simon Glass [Thu, 21 Jan 2021 20:57:15 +0000 (13:57 -0700)]
Add a symlink for ctype.h

Libraries that link with U-Boot typically may expect to be able to include
ctype.h but this file is in a different place in U-Boot. Add a symlink to
make this work.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Update ofnode_read_fmap_entry() to read hashes
Simon Glass [Thu, 21 Jan 2021 20:57:14 +0000 (13:57 -0700)]
dm: core: Update ofnode_read_fmap_entry() to read hashes

At present this function uses the old format for reading hashes. Add
support for the current format.

Add a test while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add a comment about pinctrl_select_state()
Simon Glass [Thu, 21 Jan 2021 20:57:13 +0000 (13:57 -0700)]
dm: core: Add a comment about pinctrl_select_state()

The use of pinctrl in the core of driver model is useful but can provoke
some strange behaviour. Add a comment to aid debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoclk: x86: Correct the driver name
Simon Glass [Thu, 21 Jan 2021 20:57:12 +0000 (13:57 -0700)]
clk: x86: Correct the driver name

The current driver name does not match its compatible string, so
of-platdata does not work correctly. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoclk: Add debugging for return values
Simon Glass [Thu, 21 Jan 2021 20:57:11 +0000 (13:57 -0700)]
clk: Add debugging for return values

Use the log_msg_ret() mechanism to get error-return information when
clocks fail to probe, etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Don't inline dev_read...() calls with of-platdata
Simon Glass [Thu, 21 Jan 2021 20:57:10 +0000 (13:57 -0700)]
dm: core: Don't inline dev_read...() calls with of-platdata

At present if these calls are used with of-platdata, a confusing error is
produced, referring to a function not actually called by the code causing
the problem.

Fix this by not inlining, so that the error mentions the dev_read_...()
function and it is more obvious what is going on.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Disable I2C emulators in SPL
Simon Glass [Thu, 21 Jan 2021 20:57:09 +0000 (13:57 -0700)]
sandbox: Disable I2C emulators in SPL

These cannot work with of-platdata since they currently need the
devicetree at runtime. Disable the emulators and the sandbox I2C driver
that needs them. We can enable these later, if needed for testing.

Switch the of_plat_parent test over to use a simple bus instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoi2c: desigware: Add an alias for Intel Apollo Lake
Simon Glass [Thu, 21 Jan 2021 20:57:08 +0000 (13:57 -0700)]
i2c: desigware: Add an alias for Intel Apollo Lake

Add an alias so that this driver can be used in TPL on coral.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agox86: coral: Support TPM and RTC in SPL
Simon Glass [Thu, 21 Jan 2021 20:57:07 +0000 (13:57 -0700)]
x86: coral: Support TPM and RTC in SPL

Update the devicetree so that the TPM and RTC can be used in SPL. Also
enable the pins used for getting the memory configuration settings while
we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospl: Tidy up SPL/TPL malloc sizes
Simon Glass [Thu, 21 Jan 2021 20:57:06 +0000 (13:57 -0700)]
spl: Tidy up SPL/TPL malloc sizes

The current help talks about relocation which doesn't apply to SPL and
TPL. Update it to avoid confusion.

Also make the TPL size default to the same as the SPL size, since this is
more likely to be a useful value than the one used by U-Boot proper, which
may be quite a bit larger.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add vstore support
Simon Glass [Sat, 16 Jan 2021 21:52:31 +0000 (14:52 -0700)]
cros_ec: Add vstore support

The EC can store small amounts of data for the benefit of the
verified boot process. Since the EC is seldom reset, this can allow the
AP to store data that survives a reboot or a suspend/resume cycle.

Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Allow use with of-platdata
Simon Glass [Sat, 16 Jan 2021 21:52:30 +0000 (14:52 -0700)]
cros_ec: Allow use with of-platdata

Avoid reading the device tree when of-platdata is in use.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Show events in human-readable form
Simon Glass [Sat, 16 Jan 2021 21:52:29 +0000 (14:52 -0700)]
cros_ec: Show events in human-readable form

Add a command to show the current events as a list of names. This is
easier to decipher than a bit mask.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add support for switches
Simon Glass [Sat, 16 Jan 2021 21:52:28 +0000 (14:52 -0700)]
cros_ec: Add support for switches

On x86 platforms the EC provides a way to read 'switches', which are
on/off values determined by the EC.

Add a new driver method for this and implement it for LPC.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add documentation for cros_ec driver operations
Simon Glass [Sat, 16 Jan 2021 21:52:27 +0000 (14:52 -0700)]
cros_ec: Add documentation for cros_ec driver operations

Add comments to these methods so it is documented in this central place,
not just in each driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Support reading EC features
Simon Glass [Sat, 16 Jan 2021 21:52:26 +0000 (14:52 -0700)]
cros_ec: Support reading EC features

The EC can support a variety of features and provides a way to find out
what is available. Add support for this.

Also update the feature list to the lastest available while we are here.
This is at:

   https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/master/include/ec_commands.h

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add support for reading the SKU ID
Simon Glass [Sat, 16 Jan 2021 21:52:25 +0000 (14:52 -0700)]
cros_ec: Add support for reading the SKU ID

This allows reading strapping pins attached to the EC. Add an
implementation for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add run-time check for input buffer overflow
Simon Glass [Sat, 16 Jan 2021 21:52:24 +0000 (14:52 -0700)]
cros_ec: Add run-time check for input buffer overflow

This should not happen in normal operation, but the EC might have a bug,
so add a run-time check just in case.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Tidy up a few delays
Simon Glass [Sat, 16 Jan 2021 21:52:23 +0000 (14:52 -0700)]
cros_ec: Tidy up a few delays

Allow a longer time for the EC to reboot. Also use a constant for the
hash delay time, so it is clear what it is for.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add a function for the hello message
Simon Glass [Sat, 16 Jan 2021 21:52:22 +0000 (14:52 -0700)]
cros_ec: Add a function for the hello message

This is used several times in this file. Put it in a function to avoid
code duplication.

Also add a test for this function. There are no cros_ec tests at present,
so it is time to update the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodoc/sandbox: improve formatting of command line options
Heinrich Schuchardt [Wed, 30 Dec 2020 17:10:24 +0000 (18:10 +0100)]
doc/sandbox: improve formatting of command line options

Show the command line options in bold.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: fix sandbox_cmdline_cb_test_fdt()
Heinrich Schuchardt [Fri, 25 Dec 2020 15:04:26 +0000 (16:04 +0100)]
sandbox: fix sandbox_cmdline_cb_test_fdt()

fmt does not foresee any parameter.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agox86: typo segement
Heinrich Schuchardt [Tue, 22 Dec 2020 06:53:03 +0000 (07:53 +0100)]
x86: typo segement

%s/segement/segment/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agobinman: Allow for skip_at_start when reading entries
Simon Glass [Thu, 7 Jan 2021 04:35:19 +0000 (21:35 -0700)]
binman: Allow for skip_at_start when reading entries

The offset of an entry needs to be adjusted by its skip-at-start value.
This is currently missing when reading entry data. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Support alignment of files
Simon Glass [Thu, 7 Jan 2021 04:35:18 +0000 (21:35 -0700)]
binman: Support alignment of files

When packing files it is sometimes useful to align the start of each file,
e.g. if the flash driver can only access 32-bit-aligned data. Provides a
new property to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Allow vblock to include devicetree blobs
Simon Glass [Thu, 7 Jan 2021 04:35:17 +0000 (21:35 -0700)]
binman: Allow vblock to include devicetree blobs

At present if a devicetree blob is included in a vblock it does not deal
with updates. This is because the vblock is created once at the start and
does not have a method to update itself later, after all the entry
contents are finalised.

Fix this by adjusting how the vblock is created.

Also simplify Image.ProcessEntryContents() since it effectively duplicates
the code in Section.ProcessContents().

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Support reading an image with entry args
Simon Glass [Thu, 7 Jan 2021 04:35:16 +0000 (21:35 -0700)]
binman: Support reading an image with entry args

Normally when an entry is created, any entry arguments it has are required
to be provided, so it can actually generate its contents correctly.

However when an existing image is read, Entry objects are created for each
of the entries in the image. This happens as part of the process of
reading the image into binman.

In this case we don't need the entry arguments, since we do not intend to
regenerate the entries, or at least not unless requested. So there is no
sense in reporting an error for missing entry arguments.

Add a new property for the Image to handle this case. Update the error
reporting to be conditional on this property.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Support finding symbols in sub-sections
Simon Glass [Thu, 7 Jan 2021 04:35:15 +0000 (21:35 -0700)]
binman: Support finding symbols in sub-sections

At present binman only supports resolving symbols in the same section as
the binary that uses it. This is quite limited because we often need to
group entries into different sections.

Enhance the algorithm to search the entire image for symbols.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Fix a few file comments
Simon Glass [Thu, 7 Jan 2021 04:35:14 +0000 (21:35 -0700)]
binman: Fix a few file comments

Two files have the wrong comment at the top of them. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Show the size when writing entries
Simon Glass [Thu, 7 Jan 2021 04:35:13 +0000 (21:35 -0700)]
binman: Show the size when writing entries

Update the log output to show the size, since this is useful information.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Update the TODO list
Simon Glass [Thu, 7 Jan 2021 04:35:12 +0000 (21:35 -0700)]
binman: Update the TODO list

Two of the items have been completed and I thought of another one. Update
the list.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Correct lz4 compression parameters
Simon Glass [Thu, 7 Jan 2021 04:35:11 +0000 (21:35 -0700)]
patman: Correct lz4 compression parameters

At present on large files, lz4 uses a larger block size (e.g. 256KB) than
the 64KB supported by the U-Boot decompression implementation. Also it is
optimised for maximum compression speed, producing larger output than we
would like.

Update the parameters to correct these problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: binman: Drop Python 2 code
Simon Glass [Thu, 7 Jan 2021 04:35:10 +0000 (21:35 -0700)]
dtoc: binman: Drop Python 2 code

Drop a few more Python 2 relics that are no-longer needed.

Signed-off-by: Simon Glass <sjg@chromium.org>