Commit graph

603 commits

Author SHA1 Message Date
Ville Juven
d8c907dfc7 imx9/lpuart: Fix SMP deadlock with imx9_txint
A deadlock occurs for priv->lock when uart_xmitchars is called from
within imx9_txint. This is because uart_xmitchars does a callback to
imx9_txint and tries to acquire the lock again.

However, there is no reason to hold the lock over uart_xmitchars, as it
has its own lock for mutual exclusion. Only the UART device needs to
be protected, and priv->lock does that.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
2025-06-12 15:28:18 -03:00
Ville Juven
c17f99438e imx9/smp: Add boiler plate code to enable SMP with iMX9.X
This adds SMP support for iMX9.X CPUs

Signed-off-by: Ville Juven <ville.juven@unikie.com>
2025-06-12 15:28:18 -03:00
Jukka Laitinen
56ad0d6837 arch: Flag all definitions of up_perf_* functions with CONFIG_ARCH_HAVE_PERF_EVENTS
Use the flag CONFIG_ARCH_HAVE_PERF_EVENTS to detect whether the architecture specific code
provides the up_perf_* functions. Now it is mixed with CONFIG_ARCH_PERF_EVENTS, which should
select just whether the perf events (perf_*) are enabled for the configuration.

- drivers/timers/arch_alarm.c: Don't compile the up_perf_* functions here if the
  CONFIG_ARCH_HAVE_PERF_EVENTS is defined
- arch/*/*_perf.c: Change CONFIG_ARCH_PERF_EVENTS -> CONFIG_ARCH_HAVE_PERF_EVENTS to
  select whether architecture specific up_perf_* functions are provided

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-06-06 17:31:10 +08:00
George Poulios
67c7a4018a arm64/imx9: Support & configure RGMII-ID on RTL8211F
For the RTL8211F PHY, configuration of RX/TXDLY was missing.
At least on my i.MX93 EVK, this is necessary for transmission
to work (RXDLY defaults to true on the PHY).

This commit brings support for RGMII internal delay configuration
(on or off for both directions) and enables it on the i.MX93 EVK
board. The introduced Kconfig is set to default to 'n', to avoid
breaking the functionality of other, out-of-tree boards based on
i.MX93, running the RTL8211F PHY, or to avoid introducing
unnecessary code on boards running other PHYs.

Configuration of internal delay on other PHYs is not
implemented, and results in a warning (but no error).

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-06-05 08:58:24 +02:00
George Poulios
e382e2d525 arm64/imx9: Add missing ENET1 RGMII TXC pin muxing
MUX_ENET1_TXC was missing from both the EVK board
definition and the IO muxing configuration function
of the ENET1 driver. As a result, transmission does
not work (unless the muxing is set by default in some
board? -not the case with EVK). This commit adds the
configuration and adds the definition to i.MX93 EVK.

WARN: other, out-of-tree i.MX93 boards need to define
MUX_ENET1_TXC accordingly, otherwise build will break.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-06-05 08:58:24 +02:00
Theodore Karatapanis
c6f4310331 arch/arm64/imx9: Guard EL3-only features when booting at EL1
Boards that run the i.MX9 bootloader at EL1 must not touch EL3-only
configuration. Add Kconfig guards so that:

* DDR training (IMX9_DDR_TRAINING)
* FIQ decode support (ARM64_DECODEFIQ)

are selected only when ARCH_ARM64_EXCEPTION_LEVEL == 3.

Code in arm64_chip_boot() is also guarded with ARCH_ARM64_EXCEPTION_LEVEL == 3

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-05-28 14:39:55 -03:00
raiden00pl
194b635739 arch: unify Private Types banners
unify Private Types banners according to NuttX coding standard

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-05-28 10:17:15 +08:00
wangjianyu3
e57cfc3778 arm64/toolchain: Add -fstack-usage for stack analysis
After `CONFIG_STACK_USAGE` enabled, no "*.su" file was generated, tools/showstack.sh output nothing.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-05-27 23:11:38 +08:00
wangzhi16
35a62b7d5e Revert "Reduce the size of tcb by four bytes."
This reverts commit 893c5e92c2.
2025-05-27 16:30:35 +08:00
Matteo Golin
3feb9985a5 bcm2711/spi: Create interrupt-based SPI driver.
This implements an interrupt-based SPI driver for the BCM2711 SPI
interfaces (excluding auxiliary SPI interfaces). Only tested on SPI0
since proprietary firmware does not initialize any other SPI interfaces,
and doing so will require reverse engineering.
2025-05-24 12:47:43 -03:00
Lars Kruse
3dc53adb28 arch | boards | drivers: fix whitespace issues for switch case statements 2025-05-23 10:48:41 +08:00
Lars Kruse
3ce85ca54e style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
Theodore Karatapanis
fcbd3099aa arch/arm64/imx9: Extend ELE API with RNG support
- Add ELE command to initialize the ELE RNG context.
- Add ELE command to poll the readiness of the RNG
- Add ELE command to obtain random numbers.
- Replace AHAB_ prefixes with ELE_
- Cleanup header includes
- Added some explanatory comments on .../hardware/imx9_ele.h

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-05-16 06:30:18 -03:00
buxiasen
cd7a8f73eb comments: update text typo pre-empted to preempted
Or will be catch by codespell, when do checkpatch.sh

Also fix the relative comment file changed.

include/nuttx/scsi.h
drivers/syslog/ramlog.c
excluded as we have to modify field name in struct

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-05-12 15:01:37 +08:00
Theodore Karatapanis
0011f165ff style: fix typos required by ci-cd
- Added "infor" to .codespellrc ignore-words-list.
  This term is used by NXP's ROMAPI naming conventions and is not a typo
  in this context.
- This prevents CI/CD codespell checks from failing due to false positives.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-05-09 19:21:17 +08:00
Theodore Karatapanis
5d63c3e460 arch/arm64: Allow non MMU builds.
MMU initialization is redundant for bootloaders(BL2) that load TF‑A(BL31).
TF-A will ignore and overwrite any MMU configuration performed by BL2.
Additionally the MMU comes with a large memory footprint (~50 KB)
which could be precious for such setups.

When the MMU is disabled all the memory is treated as device memory and
all alignment faults generate exceptions (as opposed to normal memory when
MMU is enabled). For that reason we need to add -fno-builtin when compiling
with CONFIG_ARCH_USE_MMU != y to prevent alignment faults.

- Guard MMU initialization with CONFIG_ARCH_USE_MMU
- If CONFIG_ARCH_USE_MMU is not set add -fno-builtin which prevents alignment errors.
- Deliberately didn't try to replace CONFIG_ARCH_HAVE_MMU with CONFIG_ARCH_USE_MMU
  occurrences, because this will break a lot of build targets that assume MMU without
  guarding the MMU initialization.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-05-09 19:21:17 +08:00
Theodore Karatapanis
d278c6cb15 arch/arm64/imx9: Add ROMAPI and AHAB support for i.MX9
This adds support for the i.MX9 ROMAPI, allowing boot in a more
device agnostic and portable manner. The ROMAPI "natively" allows to:
- Query the boot device for information.
- Copy data from the boot device to RAM.

An extra functionality was added to ROMAPI to calculate
offsets of sequential AHAB containers.

The AHAB functionality is built on top of raw ELE primitives and allows to:
- Authenticate a container image.
- Release the authenticated container.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-05-09 19:21:17 +08:00
Theodore Karatapanis
3c48031ec3 arch/arm64/imx9: Extend ELE API for container authentication
This extends ELE API to:
- Authenticate i.MX container header.
- Verify container images.
- Release resources of the authenticated containers.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-05-09 19:21:17 +08:00
George Poulios
b103a64a87 drivers/misc/optee: Add SMC backend for arm archs
So far NuttX has supported OP-TEE interfacing over
local and RPMsg sockets. This commit introduces support
for direct invocation of OP-TEE through arm SMCs. The
SMC transport is enabled through CONFIG_DEV_OPTEE_SMC.

This SMC implementation has been tested only with arm64,
OP-TEE rev 4.4.

Note that it does not support reverse direction RPCs,
i.e. from the Secure World to the Normal World to
something like optee supplicant. A basic RPC handling
skeleton is provided with implementation for some
basic functions (alloc/free mem, and foreign interrupts)
but no supplicant command handling.

(+one minor change s/parm/param in arch/arm64/include/syscall
to satisfy the spellchecker during PR)

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-09 10:29:26 +08:00
George Poulios
7ea8b59a59 boards/imx93-evk: kernel build for AHAB boot
Add kernel build (target imx93-evk:knsh) to i.MX93 EVK.
This target is preconfigured for use with AHAB boot (see
https://spsdk.readthedocs.io/en/latest/examples/ahab/imx93/imx93_ahab_uboot.html)
as a replacement of U-Boot proper (BL33 at EL2), hence
the load address is set to 0x80200000.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-03 11:25:54 +08:00
Carlos Sanchez
d976c66edf net: use bps units for bitrate in SocketCAN interfaces.
This makes units compatible with what Linux uses for SocketCAN bitrate
and allows representing usual Single Wire Can (SAE J2411) usual bitrates
of 33333 and 83333 bps.

Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
2025-04-16 11:07:27 -03:00
Carlos Sanchez
dd53c34722 net/netdev: Change SIOCSCANBITRATE to require interface down.
Previously, SIOCSCANBITRATE brought the iterface up to ensure changes
where immediately applied. This was confusing, see
https://lists.apache.org/thread/g8d0m6yp7noywhroby5br4hxt3r4og2c
Now SIOCSCANBITRATE fails is interface is up.
All existing SocketCAN drivers updated.

Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
2025-04-15 01:59:57 +08:00
chao an
52482219c8 libc/elf: rename modlib to libelf
Renaming "modlib" to "libelf" is more in line with the implementation content,
which makes it easier for individual developers to understand the capabilities of this module.

CONFIG_LIBC_MODLIB -> CONFIG_LIBC_ELF

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-04-11 09:43:22 +08:00
anjiahao
c9a150781c arch/arm64: remove unrecognized command-line option
aarch64-none-elf-gcc: error: unrecognized command-line option '-mlong-calls'

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2025-04-09 23:07:29 +08:00
anjiahao
422c43949a binfmt:use crt0 inside of starthook
test:
1.use mps3-an547 build helloxx as module and run it
2.use qemu-armv7a:knsh test kernel build helloxx and run it

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2025-04-09 23:07:29 +08:00
ouyangxiangzhen
2b53d5af8d arch/arm64: Increase the timer accuracy with the lower USEC_PER_TICK.
This commit increased the timer accuracy with the lower USEC_PER_TICK.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-03-26 19:26:37 +08:00
ouyangxiangzhen
a121c059c4 arch/arm64: Optimize the initialization of the timer.
This commit optimized the initialization of the ARM generic timer for each cpu core.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-03-26 19:26:37 +08:00
Ari Kimari
4bfbe82a3e arch/arm64/imx9: Support for imx9 edgelock enclave
Moved imx9 edgelock enclave (ELE) handling from imx9_trdc.c to own imx9_ele.c file.
Add some new messages to ele API.
Updated ele fw version to 1.3.0.
Fix channel bug on imx9_ele_sendmsg() and imx9_ele_receivemsg()

Signed-off-by: Ari Kimari <ari.kimari@tii.ae>
2025-03-17 21:35:25 +02:00
Lup Yuen Lee
9d80d6bb4f arch/arm64/a527: Add support for Allwinner A527 SoC
This PR adds support for the Allwinner A527 Arm64 SoC.
This will be used by the upcoming port of NuttX for
PINE64 Yuzuki Avaota-A1 SBC.

Most of the code was derived from NuttX for
QEMU Arm64 Kernel Build qemu-armv8a:knsh.
The modified code is explained here:
https://lupyuen.github.io/articles/avaota#appendix-port-nuttx-to-avaota-a1

Modified Files in arch/arm64:

Kconfig: Added ARCH_CHIP_SUNXI for Allwinner 64-bit SoCs.
Added ARCH_CHIP_SUNXI_A527 for A527 SoC.

New Files in arch/arm64:

include/a527/chip.h: A527 Definitions
include/a527/irq.h: External Interrupts
src/a527/chip.h: Memory Map
src/a527/a527_boot.c, a527_boot.h: Startup Code
src/a527/a527_initialize.c: Power Management
src/a527/a527_lowputc.S: UART Output
src/a527/a527_serial.c: Serial Driver
src/a527/a527_textheap.c: Text Heap
src/a527/a527_timer.c: A527 Timer
src/a527/Kconfig: A527 Config
src/a527/Make.defs, CMakeLists.txt: Makefiles

Signed-off-by: Lup Yuen Lee <luppy@appkaki.com>
2025-03-17 08:58:29 +01:00
wangmingrong1
e28c0b4ef1 arm64: Initialize sctrl_el1 when running fork
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-03-08 23:43:09 +08:00
ouyangxiangzhen
219fb1a717 arch/arm64: Add up_perf_init for qemu.
This commit added up_perf_init for qemu.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-03-06 09:31:32 +01:00
George Poulios
aa5d119bc3 arch/arm64: fix boot stage prints with CONFIG_ARCH_EARLY_PRINT=y
`boot_stage_puts` used by early asm calls arm64_lowputc() for each
character in a loop. During that loop it uses x1 as the pointer to
the next character to be printed. However, x1 is clobbered by
arm64_lowputc(), resulting in undefined behaviour (only the first
character of the string is guaranteed to be printed).

Fix this by using x19 instead.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-02-26 20:47:05 +02:00
Xiang Xiao
05ec313bc4 Revert "use small lock in following files:"
This reverts commit bbaf1ff9fd.
2025-02-13 14:15:43 +08:00
Xiang Xiao
31e92f3bb5 Revert "use small lock in following files:"
This reverts commit d84ba608a1.
2025-02-13 14:15:43 +08:00
Xiang Xiao
96093574fc Revert "Use small lock to protect resources related to lpi2c."
This reverts commit 0b542ff824.
2025-02-13 14:15:43 +08:00
Xiang Xiao
0021e7731a Revert "Because sched_lock is now called in spin_lock_irqsave, there is no need to call it explicitly."
This reverts commit b0af946b7a.
2025-02-13 14:15:43 +08:00
zouboan
22f2d39e21 arch/zynq-mpsoc improve the ethernet driver
1. Changes the phyadd to 0xC to speed up the training of phyadd.
2. Set RX DMA buffer size configureable.
3. Create netnsh configs as ethernet boot from QSPI FLASH.
4. Fix some typo in #15720 which is nonsynchronous with local code.
2025-02-07 20:21:18 +08:00
Neo Xu
ca92c208c1 arch/arm64: generate error if context size is not aligned to 16bytes
Make sure the registers context size is aligned to 16bytes as required by armv8-a.
This issue has been reported earlier, thus make sense to make sure it won't happen in future.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2025-02-05 19:28:03 +08:00
zouboan
586b9c54ac arch/arm64 Fix the SP unalignment issues
zynq-mpsoc and zcu111 borad was broken by #15437, because #15437 changes
ARM64_CONTEXT_REGS from 36 to 37, resulting in the stack no longer being
16-byte aligned which appears to violate the ARMv8-A architecture's
requirement for 16-byte stack alignment. this commit changes ARM64_CONTEXT_REGS
to 38 to fix this issues.
2025-02-04 13:18:32 +08:00
zouboan
934c93be93 arch/arm64/zynq-mpsoc: add support for ethernet gem
Zynq MPSOC The processing system (PS) is equipped with four gigabit
Ethernet controllers.Each  controller can be configured independently.
Each controller uses a reduced gigabit media independent interface (RGMII)
v2.0. This commit add support for ethernet of ZYNQ MPSOC.
2025-02-02 14:17:45 +08:00
zouboan
1452f32b14 zynq-mpsoc: add support for pll 2025-01-27 10:13:30 +08:00
buxiasen
a0fdb7f63b arm/goldfish: add ARCH_HAVE_ELF_EXECUTABLE
Able to support kernel build apps debug

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-23 23:29:51 +08:00
wangzhi16
b0af946b7a Because sched_lock is now called in spin_lock_irqsave, there is no need to call it explicitly.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-23 20:43:51 +08:00
hujun5
a095b1d6a6 arch: set (*running_task)->xcp.regs to NULL when exit from irq/exception
reason:
(*running_task)->xcp.regs is invalid when in threadcontext, we marke it as NULL to avoid misusage

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-22 23:52:17 +08:00
wangzhi16
0b542ff824 Use small lock to protect resources related to lpi2c.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-22 20:30:15 +08:00
Jukka Laitinen
20f15130aa arch/arm64/src/imx9/imx9_lpuart.c: Call uart_xmitchars when txint is enabled
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-01-22 16:53:45 +08:00
lipengfei28
82cf59bff5 arch/arm64: use UP_DSB, UP_DMB, UP_ISB as barrier standard API
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2025-01-20 20:13:07 +08:00
lipengfei28
2d1af01d44 mem barrier: use UP_DMP UP_DSP as barriers standard API
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2025-01-20 20:13:07 +08:00
Jukka Laitinen
8d635ed0bf arch/arm64/src/common/arm64_addrenv_pgmap.c: Add normal region flags to kernel page mappings
In up_addrenv_kmap_pages, the MMU_MT_NORMAL_FLAGS are needed for the MMU
mappings in order for the memory & caches to function normally

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-01-15 17:10:57 +08:00
wangmingrong1
df7d062713 kasan/kconfig: Add config CONFIG_MM_KASAN_INSTRUMENT
It will be used to distinguish between hardware KASan and software KASan. Hardware KASan does not need to use plug-in

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-14 14:01:48 +08:00