aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-07-19clk: sandbox: Add sandbox test code for Common Clock Framework [CCF]Lukasz Majewski
This patch provides code to implement the CCF clock tree in sandbox. It uses all the introduced primitives; some generic ones are reused, some sandbox specific were developed. In that way (after introducing the real CCF tree in sandbox) the recently added to clk-uclass.c: clk_get_by_id() and clk_get_parent_rate() are tested in their natural work environment. Usage (sandbox_defconfig and sandbox_flattree_defconfig): ./u-boot --fdt arch/sandbox/dts/test.dtb --command "ut dm clk_ccf" Signed-off-by: Lukasz Majewski <lukma@denx.de>
2019-07-19clk: sandbox: Adjust clk-mux.c to emulate reading divider value from HWLukasz Majewski
The generic mux clock code for CCF requires reading the clock multiplexer value from HW registers. As sandbox by design has readl() as no-op it was necessary to provide this value in the other way. The new field in the mux structure (accessible only when sandbox is run) has been introduced for this purpose. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2019-07-19clk: sandbox: Adjust clk-divider to emulate reading its value from HWLukasz Majewski
The generic divider clock code for CCF requires reading the divider value from HW registers. As sandbox by design has readl() as no-op it was necessary to provide this value in the other way. The new field in the divider structure (accessible only when sandbox is run) has been introduced for this purpose. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2019-07-19dts: sandbox: Add 'osc' clock for Common Clock Framework [CCF] testingLukasz Majewski
This patch adds the 'osc' fixed clock to facilitate the CCF testing in the sandbox U-Boot. It is a starting point for building CCF hierarchy of clocks. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2019-07-19dm: clk: Extend clk_get_parent_rate() to support CLK_GET_RATE_NOCACHE flagLukasz Majewski
If the CLK_GET_RATE_NOCACHE flag is set - the clk_get_parent_rate() provides recalculated clock value without considering the cache setting. This may be necessary for some clocks tightly coupled with power domains (i.e. imx8), and prevents from reading invalid cached values. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-07-19clk: Port Linux common clock framework [CCF] for imx6q to U-boot (tag: v5.1.12)Lukasz Majewski
This patch brings the files from Linux kernel (linux-stable/linux-5.1.y SHA1: 5752b50477da)to provide clocks support as it is used on the Linux kernel with Common Clock Framework [CCF] setup. The directory structure has been preserved. The ported code only supports reading information from PLL, MUX, Divider, etc and enabling/disabling the clocks USDHCx/ECSPIx depending on used bus. Moreover, it is agnostic to the alias numbering as the information about the clock is read from the device tree. One needs to pay attention to the comments indicating necessary for U-Boot's driver model changes. If needed, the code can be extended to support the "set" part of the clock management. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2019-07-19dm: clk: Define clk_get_by_id() for clk operationsLukasz Majewski
This commit adds the clk_get_by_id() function, which is responsible for getting the udevice with matching clk->id. Such approach allows re-usage of inherit DM list relationship for the same class (UCLASS_CLK). As a result - we don't need any other external list - it is just enough to look for UCLASS_CLK related udevices. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-07-19dm: clk: Define clk_get_parent_rate() for clk operationsLukasz Majewski
This commit adds the clk_get_parent_rate() function, which is responsible for getting the rate of parent clock. Unfortunately, u-boot's DM support for getting parent is different (the parent relationship is in udevice) than the one in Common Clock Framework [CCF] in Linux. To alleviate this problem - the clk_get_parent_rate() function has been introduced to clk-uclass.c. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-07-19dm: clk: Define clk_get_parent() for clk operationsLukasz Majewski
This commit adds the clk_get_parent() function, which is responsible for getting the parent's struct clock pointer. U-Boot's DM support for getting parent is different (the parent relationship is in udevice) than the one in Common Clock Framework [CCF] in Linux. To obtain the pointer to struct clk of parent the pdev->uclass_priv field is read via dev_get_clk_ptr() wrapper. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-07-19clk: Introduce clk-provider.h to store Common Clock Framework's internalsLukasz Majewski
This file now stores the dev_get_clk_ptr() wrapper on the dev_get_uclass_priv() function. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2019-07-19clk: Provide struct clk for fixed rate clock (clk_fixed_rate.c)Lukasz Majewski
Up till now the fixed rate clock ('osc') has been added to UCLASS_CLK without declaring struct clk. As a result it was only accessible by iterating the udevice's uclass list. This is a problem for clock code, which operates on pointers to struct clk (like clk_get_rate()), not udevices. After this change struct clk is accessible from udevice and udevice from struct clk. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-07-19clk: Extend struct clk to provide clock type agnostic flagsLukasz Majewski
This commit extends the struct clk to provide information regarding the flags related to this devices. Those flags are clk device agnostic and indicate generic features (like e.g. CLK_GET_RATE_NOCACHE - the need to always recalculate the rate). Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-07-19clk: Extend struct clk to provide information regarding clock rateLukasz Majewski
This commit extends the struct clk to provide information regarding the clock rate. As a result the clock tree traversal is performed at most once, and further reads are using the cached value. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2019-07-19clk: Remove clock ID check in .get_rate() of clk_fixed_*Lukasz Majewski
This check requires the struct clk passed to .get_rate() to be always cleared out as any clock with valid ID causes -EINVAL return value. The return code of fixed clocks shall always be returned. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-07-19dm: Fix documentation entry as there is no UCLASS_CLOCK uclassLukasz Majewski
There is no UCLASS_CLOCK uclass defined. Instead we do use the UCLASS_CLK. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-07-19clk: doc: Add documentation entry for Common Clock Framework [CCF] (i.MX)Lukasz Majewski
This patch describes the design decisions considerations and taken approach for porting in a separate documentation entry. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2019-07-18Merge branch '2019-07-17-master-imports'Tom Rini
- Various FS/disk related fixes with security implications. - Proper fix for the pci_ep test. - Assorted bugfixes - Some MediaTek updates. - 'env erase' support.
2019-07-18Revert "test: Disable pci_ep test for now"Tom Rini
We now have a proper fix for this test, stop disabling it in CI. This reverts commit ae8d23a668755d804748a1cf848426b28338b3d5. Signed-off-by: Tom Rini <trini@konsulko.com>
2019-07-18pci_ep: fix wrong addressing to barnoRamon Fried
barno was mistakely readed from the target structure, resulting in undefined behavious depending on the previous memory content. fix that. Fixes: bb413337826e ("pci_ep: add pci endpoint sandbox driver") Signed-off-by: Ramon Fried <rfried.dev@gmail.com> [trini: Drop unused bar_idx] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-07-18board: Arcturus: ucp1020: Removing obsoleted stuffOleksandr Zhadan
Removed one of the defconfig(obsoleted) file and unused CONFIG_MMC_SPI definition to avoid confusion about if this board using non-DM stuff or not. uCP1020 is completely DM free board, tested and runs well. Signed-off-by: Oleksandr Zhadan <oleks@arcturusnetworks.com> Signed-off-by: Michael Durrant <mdurrant@arcturusnetworks.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-07-18blk: Invalidate block cache when switching hwpartWeijie Gao
Some storage devices have multiple hw partitions and both address from zero, for example eMMC. However currently block cache invalidation only applies to block write/erase. This can cause a problem that data of current hw partition is cached before switching to another hw partition. And the following read operation of the latter hw partition will get wrong data when reading from the addresses that have been cached previously. To solve this problem, invalidate block cache after a successful select_hwpart operation. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2019-07-18arm: dts: MediaTek: remove tick-timer from mt7629.dtsiWeijie Gao
This patch removes tick-timer as all mt7629 boards should use arch timer. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2019-07-18configs: mt7629_rfb: use arm arch timer instead of mtk timerWeijie Gao
This patch changes mt7629_rfb to use ARM's generic arch timer instead of MediaTek's soc timer. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2019-07-18arm: dts: MediaTek: fix clock order for timer0 node of mt7629.dtsiWeijie Gao
The timer0 node has its two clocks written in reversed order. The timer0 is used as the tick timer which causes a problem that the time a delay function used is 4 times longer. This patch reverses these two clocks to solve this issue. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2019-07-18chromium: Update docs to clone vboot_reference directlySimon Glass
We don't need a full checkout of Chrome OS to build U-Boot with Chromium OS verified boot. Update the instructions accordingly and fix a typo which joins the output directory and defconfig. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-18arm: mediatek: add missing arch timer configuration for MT7629Weijie Gao
This patch sets CNTVOFF of ARM CP15 timer to zero to make sure the virtual counter is fully usable for linux kernel. Cc: Albert Aribaud <albert.u.boot@aribaud.net> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2019-07-18power-domain.h: Fix typoAnatolij Gustschin
%s/ot/to/ Signed-off-by: Anatolij Gustschin <agust@denx.de>
2019-07-18CVE-2019-13106: ext4: fix out-of-bounds memsetPaul Emge
In ext4fs_read_file in ext4fs.c, a memset can overwrite the bounds of the destination memory region. This patch adds a check to disallow this. Signed-off-by: Paul Emge <paulemge@forallsecure.com>
2019-07-18ext4: gracefully fail on divide-by-0Paul Emge
This patch checks for 0 in several ext4 headers and gracefully fails instead of raising a divide-by-0 exception. Signed-off-by: Paul Emge <paulemge@forallsecure.com>
2019-07-18CVE-2019-13104: ext4: check for underflow in ext4fs_read_filePaul Emge
in ext4fs_read_file, it is possible for a broken/malicious file system to cause a memcpy of a negative number of bytes, which overflows all memory. This patch fixes the issue by checking for a negative length. Signed-off-by: Paul Emge <paulemge@forallsecure.com>
2019-07-18CVE-2019-13105: ext4: fix double-free in ext4_cache_readPaul Emge
ext_cache_read doesn't null cache->buf, after freeing, which results in a later function double-freeing it. This patch fixes ext_cache_read to call ext_cache_fini instead of free. Signed-off-by: Paul Emge <paulemge@forallsecure.com>
2019-07-18CVE-2019-13103: disk: stop infinite recursion in DOS PartitionsPaul Emge
part_get_info_extended and print_partition_extended can recurse infinitely while parsing a self-referential filesystem or one with a silly number of extended partitions. This patch adds a limit to the number of recursive partitions. Signed-off-by: Paul Emge <paulemge@forallsecure.com>
2019-07-18qemu-riscv: enable VIRTIO_PCIDavid Abdurachmanov
libvirt v.5.3.0 with QEMU 4.0.0 or above uses PCI automatically and thus devices (network, storage, etc) are connected via PCI. Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-07-18arm: qemu: fix failure in flash initialization if booting from TF-AAKASHI Takahiro
If U-Boot is loaded and started from TF-A (you need to change SYS_TEXT_BASE to 0x60000000), it will hang up at flash initialization. If secure mode is off (default, or -machine virt,secure=off) at qemu, it will provide dtb with two flash memory banks: flash@0 { bank-width = <0x4>; reg = <0x0 0x0 0x0 0x4000000 0x0 0x4000000 0x0 0x4000000>; compatible = "cfi-flash"; }; If secure mode is on, on the other hand, qemu provides dtb with 1 bank: flash@0 { bank-width = <0x4>; reg = <0x0 0x4000000 0x0 0x4000000>; compatible = "cfi-flash"; }; As a result, flash_init()/flash_get_size() will eventually fail. With this patch applied, relevant CONFIG values are modified. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-18arm: move CONFIG_TFABOOT to generic KconfigAKASHI Takahiro
Currently, CONFIG_TFABOOT is located in armv8/fsl-layerscape Kconfig, but it will be also useful for other targets if some additional configuration are necessary. So move it to arch/arm/Kconfig. Please note that CONFIG_TFABOOT still depends on CONFIG_ARCH_SUPPORT_TFABOOT and so the menu won't come up if any target doesn't need its own customization for TF-A boot. This will maintain the compatibility. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Cc: Rajesh Bhagat <rajesh.bhagat@nxp.com> Cc: York Sun <york.sun@nxp.com> Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> Cc: Priyanka Jain <priyanka.jain@nxp.com> Cc: Sriram Dash <sriram.dash@nxp.com> Cc: Hou Zhiqiang <Zhiqiang.Hou@nxp.com> Cc: Peng Ma <peng.ma@nxp.com> Cc: Yuantian Tang <andy.tang@nxp.com> Cc: Pankit Garg <pankit.garg@nxp.com>
2019-07-18doc: Move fastboot protocol doc to android dirSam Protsenko
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
2019-07-18cmd: mem: Add a command to fill the memory with random dataJean-Jacques Hiblot
This command fills the memory with data produced by rand(). Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2019-07-18tools: mkenvimage: Always consider non-regular filesAndre Przywara
At the moment mkenvimage has two separate read paths: One to read from a potential pipe, while dynamically increasing the buffer size, and a second one using mmap(2), using the input file's size. This is problematic for two reasons: - The "pipe" path will be chosen if the input filename is missing or "-". Any named, but non-regular file will use the other path, which typically will cause mmap() to fail: $ mkenvimage -s 256 -o out <(echo "foo=bar") - There is no reason to have *two* ways of reading a file, since the "pipe way" will always work, even for regular files. Fix this (and simplify the code on the way) by always using the method of dynamically resizing the buffer. The existing distinction between the two cases will merely be used to use the open() syscall or not. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2019-07-18tools: mkenvimage: Fix reading from slow pipeAndre Przywara
It is perfectly fine for the read(2) syscall to return with less than the requested number of bytes read (short read, see the "RETURN VALUE" section of the man page). This typically happens with slow input (keyboard, network) or with complex pipes. So far mkenvimage expects the exact number of requested bytes to be read, assuming an end-of-file condition otherwise. This wrong behaviour can be easily shown with: $ (echo "foo=bar"; sleep 1; echo "bar=baz") | mkenvimage -s 256 -o out - The second line will be missing from the output. Correct this by checking for any positive, non-zero return value. This fixes a problem with a complex pipe in one of my scripts, where the environment consist of two parts. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Acked-by: Alexander Dahl <ada@thorsis.com>
2019-07-18test/py: gpt: Use long options for sgdiskSam Protsenko
sgdisk 0.8.10.2 from AOSP doesn't support short options, failing with errors like this: sgdisk: invalid option -- 'U' Test fails due to that error. Let's use long options to make the test work with any sgdisk version. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Acked-by: Stephen Warren <swarren@nvidia.com>
2019-07-18env: mmc: add erase-functionFrank Wunderlich
this adds erase environment for mmc storage squashed fixes: - add CONFIG_CMD_ERASEENV - env: erase redundant offset if defined - changes mentioned by Simon - fix whitespaces around errmsg Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Signed-off-by: Frank Wunderlich <frank-w@public-files.de> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-07-18env: register erase commandFrank Wunderlich
this patch adds basic changes for adding a erase-subcommand to env with this command the environment stored on non-volatile storage written by saveenv can be cleared. Signed-off-by: Frank Wunderlich <frank-w@public-files.de> squashed fixes - start message with "Erasing" - mark erase-function as optional - env: separate eraseenv from saveenv Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2019-07-18common: Fix autocompletion with CONFIG_CMDLINE_PS_SUPPORTMarek Vasut
The autocompletion did not work if CONFIG_CMDLINE_PS_SUPPORT was enabled because U-Boot was comparing the prompt string with CONFIG_SYS_PROMPT . While this works if CONFIG_CMDLINE_PS_SUPPORT is disabled, this no longer works if it's enabled because user can override the PS1 . Fix this by checking prompt string against the current PS1 value. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com>
2019-07-18regulator: Allow enabling GPIO regulatorSven Schwermer
Drivers need to be able to enable regulators that may be implemented as GPIO regulators. Example: fsl_esdhc enables the vqmmc supply which is commonly implemented as a GPIO regulator in order to switch between I/O voltage levels. Signed-off-by: Sven Schwermer <sven@svenschwermer.de> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-07-18regulator: Factor out common enable codeSven Schwermer
In preparation of being able to enable/disable GPIO regulators, the code that will be shared among the two kinds to regulators is factored out into its own source files. Signed-off-by: Sven Schwermer <sven@svenschwermer.de> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-07-18ARM: correct detection of thumb modeHeinrich Schuchardt
When a crash occurs in thumb mode the crash dump is incorrect. This is due to the usage of a non-existing configuration variable CONFIG_ARM_THUMB in the definition of macro thumb_mode(regs). Use CONFIG_IS_ENABLED(SYS_THUMB_BUILD) to detect that the code has been compiled for thumb mode. Remove ARM_THUMB from config_whitelist.txt. With the patch crash dumps indicate thumb mode correctly. On a system with thumb mode: => exception unaligned data abort pc : [<8f7a2b52>] lr : [<8f7ab1ef>] reloc pc : [<1780cb52>] lr : [<178151ef>] sp : 8ed8c3f8 ip : 8f7a2b4d fp : 00000002 r10: 8f7f8228 r9 : 8ed95ea8 r8 : 8ed99488 r7 : 8f7ab141 r6 : 00000000 r5 : 8ed8c3f9 r4 : 8f7f6390 r3 : 8ed9948c r2 : 00000001 r1 : 00000000 r0 : 8f7f6390 Flags: nzCv IRQs off FIQs off Mode SVC_32 (T) Code: 8f7e 466d f105 0501 (e9d5) 6700 The Flags line has '(T)' and in the Code line the output is in u16 groups. On a system without thumb mode: => exception breakpoint prefetch abort pc : [<7ff5a5c8>] lr : [<7ff675ec>] reloc pc : [<0000e5c8>] lr : [<0001b5ec>] sp : 7ee0ad80 ip : 7ff5a5cc fp : 7ff674cc r10: 00000002 r9 : 7ef0bed8 r8 : 7ffd6214 r7 : 7ef0e080 r6 : 00000000 r5 : 7ffd4090 r4 : 00000000 r3 : 7ef0e084 r2 : 00000001 r1 : 00000000 r0 : 7ffd4090 Flags: nzCv IRQs off FIQs off Mode SVC_32 Code: e1a0500d e2855001 e1c560d0 e3a00001 (e12fff1e) The Flags line does not show '(T)' and in the Code line the output is in u32 groups. Reported-by: Marek Vasut <marex@denx.de> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Marek Vasut <marex@denx.de>
2019-07-18ext4: add support for filesystems without JOURNALMarek Szyprowski
JOURNAL is optional for EXT4 (and EXT3) filesystems, so add support for skipping it. This fixes corrupting EXT4 volumes without JOURNAL after using uboot's 'ext4write' command. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-07-18ext4: fix calculating inode blkcount for non-512 blocksize filesystemsMarek Szyprowski
The block count entry in the EXT4 filesystem disk structures uses standard 512-bytes units for most of the typical files. The only exception are HUGE files, which use the filesystem block size, but those are not supported by uboot's EXT4 implementation anyway. This patch fixes the EXT4 code to use proper unit count for inode block count. This fixes errors reported by fsck.ext4 on disks with non-standard (i.e. 4KiB, in case of new flash drives) PHYSICAL block size after using 'ext4write' uboot's command. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-07-18rtc: Add DM support to ds3231Chuanhua Han
Add an implementation of the ds3231 driver that uses the driver model i2c APIs. Signed-off-by: Chuanhua Han <chuanhua.han@nxp.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-07-18lib: rsa: add support to other openssl engine types than pkcs11Vesa Jääskeläinen
There are multiple other openssl engines used by HSMs that can be used to sign FIT images instead of forcing users to use pkcs11 type of service. Relax engine selection so that other openssl engines can be specified and use generic key id definition formula. Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Cc: Tom Rini <trini@konsulko.com>