summaryrefslogtreecommitdiff
path: root/arch/riscv/include/asm
AgeCommit message (Collapse)Author
2026-03-18Merge patch series "bootm: Clean up arch-specific, pre-OS clean-up"Tom Rini
Simon Glass <[email protected]> says: Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type. It is quite hard to know what actually happens in the final milliseconds before the OS boot. This series attempts to start cleaning up U-Boot in this area. The basic intent is to create a new bootm_final() function which can be called by all archs. It provides some flags for a couple of necessary variations but otherwise it is generic. All architectures are converted over to use this new function. board_quiesce_devices() is moved into bootm_final() so that all archs benefit from it. This series fixes a bug in device_remove() is fixed where removing a parent with specialised flags (e.g. DM_REMOVE_ACTIVE_ALL) could leave children activated, since they do not match the flags. This fixes is needed to avoid bootm_final() causing test failures on sandbox. Future work could take this a little further: - Convert EFI loader to use the same function - Improve comments for cleanup_before_linux() across architectures - Support fake-run tracing on all archs Link: https://lore.kernel.org/r/[email protected]
2026-03-18riscv: Call bootm_final()Simon Glass
The RISC-V announce_and_cleanup() duplicates the common pre-boot steps. Replace it with a call to bootm_final(). Move board_quiesce_devices() into bootm_final() so it is available to all architectures. Drop the RISC-V weak definition and header declaration since the generic one in bootm.h is used instead. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2026-03-17eeprom: starfive: Correct get_pcb_revision_from_eeprom()Hal Feng
pcb_revision is stored in the pcb_revision field of ATOM4. Correct it. Move the function description to the header file. Return 0 instead of 0xFF if read_eeprom() fails. Reviewed-by: Heinrich Schuchardt <[email protected]> Fixes: aea1bd95b61e ("eeprom: starfive: Enable ID EEPROM configuration") Signed-off-by: Hal Feng <[email protected]>
2026-03-17eeprom: starfive: Simplify get_ddr_size_from_eeprom()Hal Feng
Directly return the DDR size instead of the field of 'DxxxExxx'. Move the function description to the header file. Return 0 instead of 0xFF if read_eeprom() fails. Reviewed-by: Heinrich Schuchardt <[email protected]> Fixes: aea1bd95b61e ("eeprom: starfive: Enable ID EEPROM configuration") Signed-off-by: Hal Feng <[email protected]>
2025-12-08riscv: create a custom CPU implementation for PolarFire SoCConor Dooley
PolarFire SoC needs a custom implementation of top_of_ram(), so stop using the generic CPU & create a custom CPU instead. Signed-off-by: Conor Dooley <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2025-09-19arch/riscv: Remove unused macro in encoding.hGreentime Hu
This patch remove the unused macro DRAM_BASE. Signed-off-by: Greentime Hu <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2025-07-03riscv: byteorder: add test for big-endianBen Dooks
Test for big-endian either via __RISCVEB__ which migth be rather old, or check the BYTE_ORDER if the compiler defines it (which should be any modern gcc like v12) Signed-off-by: Ben Dooks <[email protected]> Acked-by: Leo Yu-Chi Liang <[email protected]>
2025-07-03riscv: cpu: th1520: Add a routine to bring up secondary coresYao Zi
On coldboot, only HART 0 among the four HARTs of TH1520 is brought up by hardware, and the remaining HARTs are in reset states, requiring manual setup of reset address and deassertion to function normal. Introduce a routine to do the work. Signed-off-by: Yao Zi <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2025-06-13riscv: remove volatile from set_gd prototypeRasmus Villemoes
It's slightly ironic that riscv at very first had the gd pointer volatile qualified [6020faf62c3 ("riscv: nx25: include: Add header files to support RISC-V")], removed that back in 2018 [40717eb849c ("riscv: checkpatch: Fix use of volatile")], and then in 2020 this helper was added [6b9966e1aa3 ("riscv: define function set_gd()")] which needlessly had volatile in the prototype. Signed-off-by: Rasmus Villemoes <[email protected]>
2025-06-02Revert "riscv: Select appropriate image type"Mayuresh Chitale
This reverts commit 027a316828528da95a77d20632370b1bc2823f0b as discussed in [1]. [1] https://lists.denx.de/pipermail/u-boot/2025-May/590841.html Signed-off-by: Mayuresh Chitale <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2025-05-21riscv: cpu: th1520: Initialize IOPMPs in SPLYao Zi
TH1520 SoC ships several IOPMPs protecting various on-chip peripherals. They must be configured before accessing the peripherals. Let's initialize them in SPL harts_early_init(). Signed-off-by: Yao Zi <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2025-05-21riscv: cpu: Add TH1520 CPU supportYao Zi
Introduce the SoC-specific code and corresponding Kconfig entries for TH1520 SoC. Following features are implemented for TH1520, - Cache enable/disable through customized CSR - Invalidation of customized PMP entries - DRAM driver probing for SPL Signed-off-by: Yao Zi <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2025-05-21riscv: insn-def.h: Fix header guardMayuresh Chitale
Fix the erroneous header guard for insn-def.h to reflect the correct header name. Fixes: bfc8ca3f7f6 ("riscv: Add support for defining instructions") Signed-off-by: Mayuresh Chitale <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2025-05-21riscv: Access gd with inline assembly when building with LTO or ClangYao Zi
Similar to AArch64's case, Clang may wrongly fold accesses to gd pointer which is defined with register qualifier into constants, breaking various components. This patch defines gd as a macro when building with Clang or LTO, which expands to get_gd() that accesses gp pointer in assembly, making RISC-V ports function properly and preparing for introduction of LTO in the future. Board initialization code is also adapted for non-assignable gd. Reported-by: Nathaniel Hourt <[email protected]> Signed-off-by: Yao Zi <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2025-05-21riscv: Select appropriate image typeMayuresh Chitale
Select between the 32-bit or 64-bit arch type for the image headers depending on how the build is configured. Signed-off-by: Mayuresh Chitale <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2025-03-17spl: starfive: visionfive2: Disable USB overcurrent pin by default.Minda Chen
For some JH7110 boards, USB host overcurent pin is not reserved, To make USB host work, overcurrent pin must be disabled. So set the pin default disabled in spl stage. Signed-off-by: Minda Chen <[email protected]> Tested-by: E Shattow <[email protected]>
2025-03-10common: clean up setjmp.hHeinrich Schuchardt
Separate setjmp.h into an architecture independent part and an architecture specific part. This simplifies moving from using struct jmp_buf_data directly to using type jmp_buf in our code which is the C compliant way. Reviewed-by: Jerome Forissier <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
2025-01-16riscv: Enhance extension probingMayuresh Chitale
Enhance the existing extension probing mechanism by adding support for more extensions and probing using the "riscv,isa" property. This patch is ported from the latest upstream linux. Signed-off-by: Mayuresh Chitale <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2024-10-29riscv: resume needs to be a globalAnton Blanchard
If we take an exception before u-boot is relocated, there's a good chance we will end up in an endless loop of exceptions because resume is invalid until after relocation. Signed-off-by: Anton Blanchard <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2024-10-28riscv: Add support for defining instructionsMayuresh Chitale
Add insn-def.h which is similar to that in linux and contains the macros to generate any instruction of type 'I' using the assembler's .insn directive. Signed-off-by: Mayuresh Chitale <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2024-10-28cmd: sbi: Add FWFT, MPXY extensionsHeinrich Schuchardt
The SBI 3.0 specification [1] adds the following extensions: * Firmware Features Extension * Message Proxy Extension Let the sbi command detect their availability. The Firmware Features Extension is already implemented in OpenSBI. Correct the text for the DBTR extension and move it to the same position as in the specification. [1] https://github.com/riscv-non-isa/riscv-sbi-doc/releases/download/vv3.0-rc1/riscv-sbi.pdf Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2024-09-16Merge tag 'v2024.10-rc5' into nextTom Rini
Prepare v2024.10-rc5
2024-09-11ram: ast2700: Add DRAM controller initializationChia-Wei Wang
Add driver for AST2700 to initialize DRAM in SPL. This patch also refactors the Kconfig dependency of Aspeed DRAM drivers as some of them are shared among the file structures of RV and ARM ISAs. Signed-off-by: Chia-Wei Wang <[email protected]> Acked-by: Leo Yu-Chi Liang <[email protected]>
2024-09-11board: ibex_ast2700: Add FMC header supportChia-Wei Wang
Define and parse the header of the First Mutable Code (FMC) of AST2700 SoCs at runtime phase. The FMC header contains the information to load prebuilt binaries required for device initialization such as DRAM and VGA. Signed-off-by: Chia-Wei Wang <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2024-09-11riscv: Add AST2700 SoC initial platform supportChia-Wei Wang
AST2700 SoCs integrates a Ibex 32-bits RISC-V core as the boot MCU for the first stage bootloader execution, namely SPL. This patch implements the preliminary base to successfully run SPL on this RV32-based MCU to the console banner message. Signed-off-by: Chia-Wei Wang <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2024-09-10riscv: define find_{first,next}_zero_bit in asm/bitops.hMaxim Kochetkov
These seem to be missing, and trying to build fastboot cmd without them is causing errors due to these being missing. Signed-off-by: Maxim Kochetkov <[email protected]> Tested-by: E Shattow <[email protected] Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2024-05-30andes: Use UCCTLCOMMAND instead of MCCTLCOMMANDLeo Yu-Chi Liang
Use CSR_UCCTLCOMMAND instead of CSR_MCCTLCOMMAND to do cache flush operation in M-mode and S-mode. Signed-off-by: Leo Yu-Chi Liang <[email protected]>
2024-05-14board: starfive: function to read eMMC sizeHeinrich Schuchardt
The EEPROM provides information about the size of the eMMC. Provide a new function get_mmc_size_from_eeprom() to read it. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: E. Shattow <[email protected]>
2024-05-02board: starfive: Rename spl_soc_init() to spl_dram_init()Lukas Funke
Rename spl_soc_init() to spl_dram_init() because the generic function name does not reflect what the function actually does. Also spl_dram_init() is commonly used for dram initialization and should be called from board_init_f(). Signed-off-by: Lukas Funke <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2024-05-02board: sifive: Rename spl_soc_init() to spl_dram_init()Lukas Funke
Rename spl_soc_init() to spl_dram_init() because the generic function name does not reflect what the function actually does. Also spl_dram_init() is commonly used for dram initialization and should be called from board_init_f(). Signed-off-by: Lukas Funke <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2024-05-01cmd: sbi: add Supervisor Software Events extensionHeinrich Schuchardt
OpenSBI has implemented the Supervisor Software Events Extension. Allow detecting it in the sbi command. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2024-04-09eeprom: starfive: function get_product_id_from_eeprom()Heinrich Schuchardt
Export a function get_product_id_from_eeprom() to read the product ID. This value can be used for fixing up the device-tree on JH7110 based products. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2024-01-31cmd: sbi: add support for Debug Trigger ExtensionHeinrich Schuchardt
Detect and show if the SBI implements the Debug Trigger Extension. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2024-01-31board: sifive: spl: Initialized the PWM setting in the SPL stageVincent Chen
LEDs and multiple fans can be controlled by SPL. This patch ensures that all fans have been enabled in the SPL stage. In addition, the LED's color will be set to yellow. Signed-off-by: Vincent Chen <[email protected]> Co-developed-by: Nylon Chen <[email protected]> Signed-off-by: Nylon Chen <[email protected]> Co-developed-by: Zong Li <[email protected]> Signed-off-by: Zong Li <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2024-01-07riscv: add ACPI fields to global dataHeinrich Schuchardt
Add fields for the location of ACPI tables to the global data. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2023-12-27andes: cpu: Enable cache and TLB ECC supportLeo Yu-Chi Liang
Andes CPU supports cache and TLB ECC. Enable them by default. Signed-off-by: Leo Yu-Chi Liang <[email protected]> Reviewed-by: Yu Chien Peter Lin <[email protected]>
2023-12-27andes: cpu: Enable memboost featureLeo Yu-Chi Liang
Andes CPU has memboost feature including prefetch, write-around and non-blocking load. Enable them by default. Signed-off-by: Leo Yu-Chi Liang <[email protected]> Reviewed-by: Yu Chien Peter Lin <[email protected]>
2023-12-27andes: csr.h: Clean up CSR definitionLeo Yu-Chi Liang
Signed-off-by: Leo Yu-Chi Liang <[email protected]> Reviewed-by: Yu Chien Peter Lin <[email protected]>
2023-12-21global: Rework architecture global_data.h to include <linux/types.h>Tom Rini
In most cases, the architecture global data currently makes use of assorted linux types, but does not include <linux/types.h> to provide them. Add <linux/types.h> instead of relying on indirect inclusion. Reviewed-by: Simon Glass <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2023-11-28riscv: io.h: Fix signatures of reads/writes functionsIgor Prusov
Change type of address parameter from int* to volatile void* for {read,write}s{b,w,l}() functions and add const qualifier for reads. This is done to keep function signatures in sync with asm-generic/io.h and other platforms. Signed-off-by: Igor Prusov <[email protected]>
2023-11-28riscv: io.h: Add defines for reads/writes functionsIgor Prusov
Add defines for {read,write}s{b,w,l} functions to make asm-generic/io.h aware of them. Signed-off-by: Igor Prusov <[email protected]>
2023-11-02riscv: import read/write_relaxed functionsChanho Park
This imports mmio functions from Linux's arch/riscv/include/asm/mmio.h to use read/write[b|w|l|q]_relaxed functions. Signed-off-by: Chanho Park <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2023-11-02riscv: cpu: jh7110: Add gpio helper macrosChanho Park
Add gpio.h header file that includes JH7110 helper macros. The file is imported from StarFive github[1] with small changes such as alignment. [1]: https://github.com/starfive-tech/u-boot Signed-off-by: Chanho Park <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2023-10-24riscv: Remove common.h usageTom Rini
We can remove common.h from most cases of the code here, and only a few places need an additional header instead. Signed-off-by: Tom Rini <[email protected]> Reviewed-by: Rick Chen <[email protected]>
2023-10-19riscv: Add Zbb support for building U-BootYu Chien Peter Lin
This patch adds ISA string to the -march to generate zbb instructions for U-Boot binaries, along with optimized string functions introduced from Linux kernel. Signed-off-by: Yu Chien Peter Lin <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2023-10-02Merge branch 'next'Tom Rini
Signed-off-by: Tom Rini <[email protected]>
2023-09-22Record the position of the SMBIOS tablesSimon Glass
Remember where these end up so that we can pass this information on to the EFI layer. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2023-09-05risc-v: implement DBCN write byteHeinrich Schuchardt
The DBCN extension provides a Console Write Byte call. Implement function sbi_dbcn_write_byte to invoke it. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>
2023-08-31event: Convert existing spy records to simpleSimon Glass
Very few of the existing event-spy records use the arguments they are passed. Update them to use a simple spy instead, to simplify the code. Where an adaptor function is currently used, remove it where possible. Signed-off-by: Simon Glass <[email protected]>
2023-08-10cmd/sbi: display new extensionsHeinrich Schuchardt
The SBI specification v2.0-rc2 defines new extensions: * Nested Acceleration Extension (NACL) * Steal Time Accounting (STA) Allow the sbi command to display these. Add missing implementation IDs. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Leo Yu-Chi Liang <[email protected]>