Commit graph

24187 commits

Author SHA1 Message Date
Tiago Medicci Serrano
fcff16a0a8 arch/risc-v: Add ARCH_HAVE_RAMFUNCS to ESP32-C6 and ESP32-H2
Following the https://github.com/apache/nuttx/pull/14741, add the
`ARCH_HAVE_RAMFUNCS` config to ESP32-C6 and ESP32-H2 to suppress
the RWX memory region warning.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-02-26 09:16:18 +01:00
leocafonso
f4b6cf2b9f arch/ra4: Add support for Renesas RA4M1 MCU
Add basic support for RA4M1.
The following perpheral are added:
* GPIO
* SCI (UART)
* Clock (Just internal clock - HOCO)

Signed-off-by: leocafonso <leocafonso@gmail.com>
2025-02-25 13:14:48 -03:00
Filipe Cavalcanti
b89ad74660 xtensa/esp32: use common Espressif wireless source
Update the wireless symbols from ESP32_* to ESPRESSIF_* for using common layer.
Remove ESP32 specific WiFi files and edit build system to use common layer.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-02-25 12:35:46 +01:00
SPRESENSE
96de2e20c1 arch: cxd56xx: Improve i2c initialize function
During I2C communication between non-Spresense devices is performed,
the I2C bus may freeze after initialization of the Spresense I2C.
As a workaround, switch the pin mode to I2C at the end of the i2c
initialization function.

Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com>
2025-02-25 10:55:20 +01:00
SPRESENSE
d521b926aa arch: cxd56xx: Improve i2c reset function
During I2C communication between non-Spresense devices is performed,
the I2C bus may freeze after initialization of the Spresense I2C.
As a workaround, add clock gating process and disable GPIO input
to the I2C reset function.

Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com>
2025-02-25 10:55:20 +01:00
SPRESENSE
eef122260b arch: cxd56xx: Update delay value for subcore
Update delay value for subcore referred by up_mdelay function.

Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com>
2025-02-25 14:46:10 +08:00
Felipe Moura
70f070fa1c riscv/esp32c6: Fix issue related esp32c6 usbserial driver.
This commit disables optimization that alters ESP32C6 interrupt registers.
Without this optimization, the USB serial driver does not work properly.
This is a temporary workaround until a proper fix is found.

Signed-off-by: Felipe Moura de Oliveira <moura.fmo@gmail.com>
2025-02-24 15:17:46 +01:00
Eren Terzioglu
713c10717c esp32[s2|s3|c3|c6|h2]: Update common layer
Update common layer to prevent build errors

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-02-24 10:35:11 -03:00
Eren Terzioglu
5865d2a8ff esp32[s2|s3]: Enhance SPIRAM/PSRAM support
Add esp_spiram_writeback_range function to flush some areas of spiram cache

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-02-24 10:35:11 -03:00
Michal Lenc
54954e55b5 samv7/pwm: fix incorrect write of CMRx register
DTE (dead time enable) is the 17th bit in CMRx (channel mode) register.
Function pwm_set_polarity did however read and write this register as
16 bit large, therefore dead time generation was always disabled.
This fixes the issue, pwm_set_polarity now reads the register as 32
large.

Also set the initial value of CMRx correctly in pwm_setup().

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-02-23 23:21:44 +01:00
Tiago Medicci Serrano
8956fc440f xtensa/esp32[|s3]: re-enable cache during exception handler
This commit implements re-enabling the cache before the exception
handler for ESP32-S3 and removes unnecessary checks (cache should
always be re-enabled during an exception handler and disabled again
after processed, except for ESP32-S3 that implements no recoverable
exceptions).

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-02-23 07:51:14 -03:00
Michal Lenc
7ccd6e9041 samv7/pwm: add support for latched fault inputs
This adds configuration option for every fault input, that can be
latched (kept even after the input value is below the threshold) or
volatile (PWM is automatically enabled once the output polarity goes
back to the normal state).

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-02-23 07:49:34 -03:00
Jukka Laitinen
824dd70617 arch/risc-v/src/mpfs: Move PLIC interrupt enable/disable to mpfs_plic.c and handle pending interrupts
- Move PLIC interrupt enable and disable functions into mpfs_plic.c
- When enabling interrupts, always clear pending interrupt
- Remove race conditions between irq enable/disable by adding spinlock
  - An interrupt may trigger on one hart in the middle of enabling the interrupts - then the interrupt
    handler might call up_disable_irq.

A pending interrupt would trigger immediately when enabling the interrupt source,
but this is not expected. The interrupt source is level sensitive, so it should
only trigger if the source is active at the time when it is enabled. Not if it
was active sometime in the past.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-02-23 09:51:37 +08:00
Jukka Laitinen
ee98106bc5 arch/risc-v/src/mpfs: Implement wrcomplete support for coremmc driver
If CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE is defined, the coremmc driver
uses SD card's dat0 line to detect whether the sd card is still busy.

This requires that the FPGA design using coremmc block wires dat0 line
to some fabric irq; and configures CONFIG_MPFS_COREMMC_WRCOMPLETE_IRQNUM
to point to that. Default for the irq number is 4. (MSS_INT_F2M_4)

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-02-23 09:49:24 +08:00
Ville Juven
17a80e90bd arch/mcx-nxxx: Add support for NXP MCX-N236 CPU
This adds minimal support for NXP MCX-N236 CPU. Peripherals supported are:
- GPIO
- PINMUX
- CLOCK
- LPUART

An example board, FRDM-MCXN236 is also added, with a basic profile that
boots into nsh.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
2025-02-22 16:12:06 -03:00
simbit18
35a793ed17 [nxstyle] fix Relative files path
fix Relative file path does not match actual file.

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-02-21 15:36:05 +01:00
Eren Terzioglu
c80e69e5e5 esp32[c3|c6|h2]: Update common layer
Update common layer to prevent build errors

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-02-21 20:48:15 +08:00
Eren Terzioglu
3661cdeed9 esp32[c3|c6|h2]: Add I2S support
Add I2S support for risc-v based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-02-21 20:48:15 +08:00
Eren Terzioglu
f286a63223 esp32[c3|c6|h2]: Add DMA function to have more capabilites
Add DMA function to increase DMA peripheral capabilities

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-02-21 20:48:15 +08:00
Ville Juven
ff4d461fda mpfs_irq.c: Interrupt claim must be cleared before disabling the source
From Polarfire SoC TRM:

6.5.8 Interrupt Completion

To signal the completion of executing an interrupt handler, the processor core writes the received interrupt ID to the
Claim/Complete register. The PLIC does not check whether the completion ID is the same as the last claim ID for that
target. If the completion ID does not match an interrupt source that is currently enabled for the target, the completion
is ignored.

The last paragraph clearly states that IRQ completion does not work for
sources that have been disabled -> must ACK the completion before disable.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
2025-02-19 15:22:16 -03:00
Filipe Cavalcanti
becba7153f arch/risc-v: improve nested interrupt assertion on riscv_doirq 2025-02-19 14:55:33 -03:00
Tiago Medicci Serrano
b417495284 arch/risc-v: support backtrace dump during IRQ
Adds support for backtrace when the system crashes during IRQ for RISC-V.
Tested with SMP, no SMP and no interrupt stack.
2025-02-19 14:55:33 -03:00
Tiago Medicci Serrano
97aa90570c xtensa/esp32s3: allow moving .bss data to the external PSRAM
This commit allows placing .bss data into the external PSRAM.
Previously, the PSRAM was fully allocated to the heap memory only
and now part of it can be used to allocate .bss data freeing the
internal memory.
2025-02-19 11:44:18 -03:00
Roy Feng
c9a8f96aac xtensa/esp32: set cpuint to initial value after deallocate
on ESP32, cpuint was allocated when register wdt handler, but not
deallocated when unregister, which cause debug assert when checking
`DEBUGASSERT((*freeints & bitmask) == 0)`, so set cpuint to initial value
after deallocate.

The same issue on ESP32s3 has been fixed by PR#15433
2025-02-18 11:32:07 -03:00
chao an
27d5a1b4b7 arm/memory_barrier: fix build warning on GCC14
nuttx/include/arch/spinlock.h:66:9: warning: "UP_DSB" redefined
   66 | #define UP_DSB() __asm__ __volatile__ ("dsb sy" : : : "memory")
      |         ^~~~~~
In file included from nuttx/include/arch/barriers.h:37,
                 from nuttx/include/arch/spinlock.h:34:
nuttx/include/arch/armv8-m/barriers.h:42:9: note: this is the location of the previous definition
   42 | #define UP_DSB()  arm_dsb(15)
      |         ^~~~~~
nuttx/include/arch/spinlock.h:67:9: warning: "UP_DMB" redefined
   67 | #define UP_DMB() __asm__ __volatile__ ("dmb st" : : : "memory")
      |         ^~~~~~
nuttx/include/arch/armv8-m/barriers.h:41:9: note: this is the location of the previous definition
   41 | #define UP_DMB()  arm_dmb()
      |         ^~~~~~

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-18 09:04:54 -05:00
chao an
5a64967ce7 nuttx/compiler: fix build warning on GCC14
nuttx/include/arch/armv8-m/irq.h:496:36: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  496 | static always_inline_function bool up_interrupt_context(void)
      |                                    ^~~~~~~~~~~~~~~~~~~~
nuttx/include/arch/armv8-m/irq.h:490:41: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  490 | static always_inline_function uintptr_t up_getusrsp(void *regs)
      |                                         ^~~~~~~~~~~
nuttx/include/arch/armv8-m/irq.h:477:40: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  477 | static always_inline_function uint32_t up_getsp(void)
      |                                        ^~~~~~~~
nuttx/include/arch/armv8-m/irq.h:451:40: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  451 | static always_inline_function uint32_t getpsp(void)
      |                                        ^~~~~~
nuttx/include/arch/armv8-m/irq.h:441:36: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  441 | static always_inline_function void setcontrol(uint32_t control)
      |                                    ^~~~~~~~~~
nuttx/include/arch/armv8-m/irq.h:428:40: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  428 | static always_inline_function uint32_t getcontrol(void)
      |                                        ^~~~~~~~~~

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-18 09:04:54 -05:00
Filipe Cavalcanti
954081cdd8 xtensa/esp32s3: use common Espressif wireless source
Update the wireless symbols from ESP32S3_* to ESPRESSIF_* for using common layer.
Remove ESP32S3 specific WiFi files and edit build system to use common layer.
2025-02-17 12:03:57 +01:00
Ville Juven
c57c95755d mpfs/mpfs_irq.c: Enable interrupts on all harts
Instead of enabling an interrupt on the calling hart, enable it on every
hart. This should balance the interrupt load some, especially in cases
where the interrupt source is enabled only once (which will almost
certainly happen on CPU 0 only).

Signed-off-by: Ville Juven <ville.juven@unikie.com>
2025-02-16 10:25:19 +01:00
buxiasen
af0aa78cbc arm-a/shm: fix issue when use shm in arm-a
When the l1entry first add to shm, mssing l1entry add.
shm mmu flags should use udata flags.
l1entry record in shm[] and should not use ~SECTION_MASK

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-02-15 18:44:26 -03:00
buxiasen
71888c5c5f arm-v7a: fix mmu record list occupation when more than 1M
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-02-15 18:44:26 -03:00
Andre Heinemans
e7fdaeb61d imx9: scmi: update to scmi 3.2 spec 2025-02-15 12:28:10 -03:00
Ramin Seyed-Moussavi
70d092061d arch/arm/max326xx: add max32690 gpio driver
definitions for the max32660 moved to max32660_gpio.h

the max32690 has much more options for the gpios
so this is a complete new driver
2025-02-15 10:23:01 -03:00
Michal Lenc
c70a322ec7 samv7/sam_1wire.c: fix compilation warnings
chip/sam_1wire.c:921:7: warning: implicit declaration of function 'sam_usart0_enableclk' [-Wimplicit-function-declaration]
  921 |       sam_usart0_enableclk();

The same warning applied for other uart/usart peripherals configured
as 1 wire.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-02-15 09:51:29 -03:00
Alan Carvalho de Assis
3594f9d879 stm32: Add support to TIOCGICOUNT ioctl
This commit adds support to TIOCGICOUNT for STM32, this way a
userspace application can collect information about UART errors.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-02-14 18:24:47 +01:00
Peter van der Perk
4907607f3a imx95: make gpio irq configurable per bank
This avoids receiving interrupt from unused GPIO banks
2025-02-14 11:37:04 -03:00
Tiago Medicci Serrano
fc3babb113 arch/risc-v: move stack boundary check into backtrace
This modification moves the boundary check inside backtrace function.
Affects builds with CONFIG_ARCH_INTERRUPSTACK>15.
2025-02-14 09:40:38 +08: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
6c7b440f47 Revert "Use small lock to protect usbdev and endpoint in AVR."
This reverts commit 007a3fffac.
2025-02-13 14:15:43 +08:00
Xiang Xiao
8fd8af9edc Revert "Use small lock to protect usbdev and endpoint in sim."
This reverts commit 4558db18e4.
2025-02-13 14:15:43 +08:00
Xiang Xiao
556a81d8e4 Revert "Use small lock to protect usbdev and endpoint in arch mips"
This reverts commit ac2b495945.
2025-02-13 14:15:43 +08:00
Xiang Xiao
a488b22b22 Revert "Use small lock to protect usbdev and endpoint in arch renesas."
This reverts commit e211904640.
2025-02-13 14:15:43 +08:00
Xiang Xiao
2301fd5d25 Revert "Use small lock to protect usbdev and endpoint in arch ARM."
This reverts commit e177ff9c0c.
2025-02-13 14:15:43 +08:00
Xiang Xiao
6d2f81f490 Revert " Use small lock to protect timer related resources in arch ARM."
This reverts commit 5f77da4c51.
2025-02-13 14:15:43 +08:00
Xiang Xiao
52d0b4ccf4 Revert "Use small lock to protect resources related to cpufifo."
This reverts commit 8b5ea40a2b.
2025-02-13 14:15:43 +08:00
Xiang Xiao
191e3ba1f7 Revert "Use small lock to protect resources related to timers in arch risc-v, xtensa and tricore."
This reverts commit ecaddbb0aa.
2025-02-13 14:15:43 +08:00
Xiang Xiao
9e687ca896 Revert "Use small lock to protect resources related to irq in arch avr, hc, mips and or1k."
This reverts commit bed3bd0852.
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
f9076d53c4 Revert "Use small lock to protect resources related to irq in arch risc-V and xtensa."
This reverts commit 099801630d.
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