aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-09-25Merge tag 'dm-next-25sep22' of ↵WIP/25Sep2022-nextTom Rini48-404/+765
https://gitlab.denx.de/u-boot/custodians/u-boot-dm into next sandbox SCSI conversion to driver model final patch for blk improvements
2022-09-25sandbox: Add a test for SCSISimon Glass5-0/+58
Add a simple uclass test for SCSI. It reads the partition table from a disk image and checks that it looks correct. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25sandbox: Convert to use driver model for SCSISimon Glass9-29/+135
At present sandbox is producing a warning about SCSI migration. Drop the legacy code and replace it with a new implementation. Also drop the SATA command, which does not work with driver model. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25sandbox: scsi: Move request-handling code to scsi_emulSimon Glass4-77/+109
Move this code into the emulator file so it can be used by multiple drivers. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25sandbox: Enable SCSI for all buildsSimon Glass5-2/+22
This will be needed to run unit tests, once the SCSI code is used for USB as well. Enable it for all sandbox builds. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25sandbox: scsi: Move structs to header fileSimon Glass2-26/+55
Move these to the SCSI header file so we can access them from multiple emulators. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25sandbox: scsi: Remove setup calls from handle_read()Simon Glass1-7/+22
Move the device-specific code out into the top-level function. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25sandbox: scsi: Move reply setup out of helperSimon Glass1-13/+9
Move this code out of the helper function so we can (later) add it as part of the shared emulation code. Set a default value of 0 for buff_used since that is what we use when there is an error. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25sandbox: scsi: Move file size into shared structSimon Glass2-4/+5
Move this information into struct scsi_emul_info so we can use it in common code. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25sandbox: scsi: Move block size into shared structSimon Glass2-5/+8
Move this information into struct scsi_emul_info so we can use it in common code. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25scsi: Move vendor/product info into the shared structSimon Glass2-6/+9
Move this information into struct scsi_emul_info so we can use it in common code. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25sandbox: Move buffer to scsi_emul_infoSimon Glass2-11/+35
Move the buffer into this struct so it can be shared between different implementations. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25scsi: Move core emulation state into a new structSimon Glass2-30/+62
In preparation for sharing the emulation code between two drivers, move some of the fields into a new struct. Use a separate header file so it can be used by various drivers. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25scsi: Move cmd_phase enum to the headerSimon Glass2-15/+22
This can be used by common files, so move it to the SCSI header and rename it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25sandbox: usb: Rename transfer_len in protocol structSimon Glass1-3/+3
This has the same name as a field in our local private struct, which is confusing. Change the name to xfer_len instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25scsi: Tidy up comments for struct scsi_cmdSimon Glass1-18/+38
These comments are bit of a mess. Tidy them up to match the correct coding style. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25blk: Rename if_type to uclass_idSimon Glass28-232/+231
Use the word 'uclass' instead of 'if_type' to complete the conversion. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-25sandbox: unblock signal before calling execv()Heinrich Schuchardt1-0/+16
The following faulty behavior was observed. The sandbox configured with CONFIG_SANDBOX_CRASH_RESET=y was invoked with ./u-boot -T -S After executing `exception undefined' the sandbox reboots. When executing `exception undefined' the sandbox exits with SIGSEGV. The expected behavior is that the sandbox should reboot again. If we are relaunching the sandbox in a signal handler, we have to unblock the respective signal before calling execv(). See signal(7) man-page. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-24Merge branch '2022-09-24-add-console-flush' into nextTom Rini15-43/+205
To quote the author: On certain places it is required to flush output print buffers to ensure that text strings were sent to console or serial devices. For example when printing message that U-Boot is going to boot kernel or when U-Boot is going to change baudrate of terminal device. Some console devices, like UART, have putc/puts functions which just put characters into HW transmit queue and do not wait until all data are transmitted. Doing some sensitive operations (like changing baudrate or starting kernel which resets UART HW) cause that U-Boot messages are lost. Therefore introduce a new flush() function, implement it for all serial devices via pending(false) callback and use this new flush() function on sensitive places after which output device may go into reset state. This change fixes printing of U-Boot messages: "## Starting application at ..." "## Switch baudrate to ..." In addition, take a patch from Heinrich to rename some EFI test functions in order to not conflict with this series.
2022-09-24boot: Call flush() before bootingPali Rohár3-0/+4
In a lot of cases kernel resets UART HW. To ensure that U-Boot messages printed before booting the kernel are not lost, call new U-Boot console flush() function. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-24serial: Call flush() before changing baudratePali Rohár2-0/+6
Changing baudrate is a sensitive operation. To ensure that U-Boot messages printed before changing baudrate are not lost, call new U-Boot console flush() function. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-24serial: Implement serial_flush() function for console flush() fallbackPali Rohár4-0/+26
Like in all other console functions, implement also serial_flush() function as a fallback int console flush() function. Flush support is available only when config option CONSOLE_FLUSH_SUPPORT is enabled. So when it is disabled then provides just empty static inline function serial_flush(). Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-24serial: Implement flush callbackPali Rohár1-0/+20
UART drivers have putc/puts functions which just put characters into HW transmit queue and do not wait until all data are transmitted. Implement flush callback via serial driver's pending(false) callback which waits until HW transmit all characters from the queue. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-24console: Implement flush() functionPali Rohár5-0/+92
On certain places it is required to flush output print buffers to ensure that text strings were sent to console or serial devices. For example when printing message that U-Boot is going to boot kernel or when U-Boot is going to change baudrate of terminal device. Therefore introduce a new flush() and fflush() functions into console code. These functions will call .flush callback of associated stdio_dev device. As this function may increase U-Boot side, allow to compile U-Boot without this function. For this purpose there is a new config CONSOLE_FLUSH_SUPPORT which is enabled by default and can be disabled. It is a good idea to have this option enabled for all boards which have enough space for it. When option is disabled when U-Boot defines just empty static inline function fflush() to avoid ifdefs in other code. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-24sandbox: Add function os_flush()Pali Rohár2-0/+13
It flushes stdout. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-24efi_selftest: prefix test functions with efi_st_Heinrich Schuchardt1-43/+44
An upcoming patch set creates a global function flush(). To make debugging easier we should not use the same name for a static function. Rename static functions in the LoadImage() unit test adding an efi_st_ prefix. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-09-23Merge branch '2022-09-23-4gb-ddr-in-32bit-ppc' into nextTom Rini41-50/+131
To quote the author, for the first 9 patches: This patch series fixes U-Boot code to correctly handle RAM size larger than 2 GB and then fixes fsl ddr driver to do not crash U-Boot when 4 GB DDR module is detected when U-Boot operates in 32-bit mode (as opposite of the 36-bit mode). With this patch series it is possible to boot 32-bit U-Boot with 4 GB SODIMM DDR3 module without crashes. U-Boot will still use just CONFIG_MAX_MEM_MAPPED amount of RAM, but it is better than crashing due to the truncating of 4GB value to 32-bit number (which is zero). I tested this patch series on powerpc P2020 based board but only with U-Boot v2022.04 because U-Boot master branch is still broken on P2020. And then the final two patches here are (in my mind at least) related clean-ups.
2022-09-23board_f: show_dram_config: Print also real DRAM sizeWIP/2022-09-23-4gb-ddr-in-32bit-ppcPali Rohár1-1/+36
32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory. U-Boot currently prints only effective size of RAM which can use, which may be misleading as somebody would expect that this line prints total size of connected DDR modules. So change show_dram_config code to prints both real and effective DRAM size if they are different. If they are same then print just one number like before. It is possible that effective size is just few bytes smaller than the real size, so print both numbers only in case function print_size() prints formats them differently. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-23display_options: print_size: Fix order overflowPali Rohár2-0/+9
Function print_size() round size to the nearst value with one decimal fraction number. But in special cases also unit order may overflow. For example value 1073689396 is printed as "1024 MiB" and value 1073741824 as "1 GiB". Fix this issue by detecting order overflow and increasing unit order. With this change also value 1073689396 is printed as "1 GiB". Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-23powerpc/mpc85xx: Fix re-align of unmapped DDR memory message for non-SPL buildsPali Rohár1-0/+3
During init_dram() is called also setup_ddr_tlbs_phys() function which may print message about unmapped DDR memory. So in this case print also re-aligning filler after unmapped DDR memory message. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-23powerpc/mpc85xx: Explain TLB unmapped memory messagePali Rohár1-1/+1
Currently U-Boot SPL prints just generic message "2 GiB left unmapped". Change it to more detailed "2 GiB of DDR memory left unmapped in U-Boot". This is just U-Boot configuration and operating system may map more (or also less) memory. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-23ddr: fsl: Fix re-align of verbose DRAM information for non-SPL buildsPali Rohár1-0/+3
During init_dram() is called also compute_lowest_common_dimm_parameters() function which prints multi-line detailed output. So print also re-aligning filler after "Detected ?DIMM" line to have "DRAM: " output aligned. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-23ddr: fsl: Allow to detect 4 GB DDR modules in 32-bit modePali Rohár1-4/+10
U-Boot core code already handles the case when RAM size is bigger than CONFIG_MAX_MEM_MAPPED. So there is no need to do duplicate check in fsl ddr driver for CONFIG_MAX_MEM_MAPPED. Instead simplify code to just check if RAM size can be representable in phys_size_t type. And avoid printing warning if phys_size_t is just 1 byte smaller than RAM size, which is the typical situation with 4 GB DDR module. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-23ddr: fsl: Fix fsl_ddr_sdram_size() for 4GB modules with 32-bit phys_size_tPali Rohár1-0/+4
Function fsl_ddr_compute() always return size in unsigned long long type, but function fsl_ddr_sdram_size() returns size in phys_size_t type. When 36-bit addressing mode is not enabled then phys_size_t type is only 32-bit and thus it cannot store value 4GB (0x100000000). Function fsl_ddr_sdram_size() in this case returns truncated value 0x0. Fix this issue by returning the highest representable value, which is 0xffffffff (4GB - 1 byte). This change fixes crashing of proper U-Boot because it detected 4 GB module as RAM with zero size. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-23ddr: fsl: Fix checking for maximal mappable memoryPali Rohár1-5/+14
Check needs to be done against CONFIG_MAX_MEM_MAPPED macro and not fixed size 4GB (as CONFIG_MAX_MEM_MAPPED can be lower and for example for e500 cores it is just 2GB). Also fix printf re-align, which should be applied only for non-SPL builds, during init_dram() call. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-23board_f: Fix printing gd->ram_size and gd->ram_topPali Rohár1-2/+2
Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not have to fit into ulong type. So cast them into unsigned long long. Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t") Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-23board_f: Fix types for board_get_usable_ram_top()Pali Rohár35-36/+36
Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t") changed type of ram_top member from ulong to phys_addr_t but did not changed types in board_get_usable_ram_top() function which returns value for ram_top. So change ulong to phys_addr_t type also in board_get_usable_ram_top() signature and implementations. Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t") Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-23common/memsize.c: Fix get_effective_memsize() to check for overflowPali Rohár1-3/+15
Ensure that top of RAM can be represented by phys_size_t type. If RAM is too large or RAM base address is too upper then limit RAM size to prevent address space overflow. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-23common/memsize.c: Fix get_effective_memsize() to always check for ↵Pali Rohár1-1/+1
CONFIG_MAX_MEM_MAPPED CONFIG_MAX_MEM_MAPPED when defined specifies upper memory mapped limit. So check for it always, and not only when CONFIG_VERY_BIG_RAM is defined. Signed-off-by: Pali Rohár <pali@kernel.org>
2022-09-23Merge branch '2022-09-23-add-mediatek-mt7986-support' into nextTom Rini70-548/+9511
To quote the author: This patch series add support for MediaTek MT7981/MT7986 SoCs with their reference boards and related drivers. This patch series add basic boot support on eMMC/SD/SPI-NOR/SPI-NAND for these boards. The clock, pinctrl drivers and the SoC initializaton code are also included. Product spec for MT7986: https://www.mediatek.com/products/home-networking/mediatek-filogic-830
2022-09-23MAINTAINERS: update maintainer for MediaTek ARM platformWeijie Gao1-0/+6
Add new files for MediaTek ARM platform Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2022-09-23tools: mtk_image: add support for nand headers used by newer chipsWeijie Gao3-30/+525
This patch adds more nand headers in two new types: 1. HSM header, used for spi-nand thru SNFI interface 2. SPIM header, used for spi-nand thru spi-mem interface The original nand header is renamed to AP header. Tested-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2022-09-23tools: mtk_image: split the code of generating NAND header into a new fileWeijie Gao5-289/+389
The predefined NAND headers take too much spaces in the mtk_image.c. Moving them into a new file can significantly improve the readability of both mtk_image.c and the new mtk_nand_headers.c. This is a preparation for adding more NAND headers. Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2022-09-23tools: mtk_image: split gfh header verification into a new functionWeijie Gao1-30/+21
The verification code of gfh header for NAND and non-NAND are identical. It's better to define a individual function to reduce redundancy. Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2022-09-23cpu: add basic cpu driver for MediaTek ARM chipsWeijie Gao2-0/+87
Add basic CPU driver used to retrieve CPU model information. Tested-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-23clk: mediatek: add clock driver support for MediaTek MT7981 SoCWeijie Gao3-0/+951
This patch adds clock driver support for MediaTek MT7981 SoC Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2022-09-23clk: mediatek: add clock driver support for MediaTek MT7986 SoCWeijie Gao3-0/+922
This patch adds clock driver support for MediaTek MT7986 SoC Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2022-09-23clk: mediatek: add CLK_XTAL support for clock driverWeijie Gao2-1/+6
This adds the CLK_XTAL macro/flag to allow modeling clocks which are directly connected to the xtal clock. Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2022-09-23clk: mediatek: add infrasys clock mux supportWeijie Gao2-1/+74
This patch adds infrasys clock mux support for mediatek clock drivers. Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2022-09-23clk: mediatek: add support to configure clock driver parentWeijie Gao2-33/+48
This patch adds support for a clock node to configure its parent clock where possible. Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>