From bcf4883d60480c955fb25c69f0cd2c40c3ef0a56 Mon Sep 17 00:00:00 2001 From: Mike Engel Date: Tue, 12 May 2026 16:56:08 +0200 Subject: [PATCH] linux-dey-6.6: update RT patches to v6.6-stm32mp-r3 Linux release Sync STM32MP-specific RT kernel patches, aligned with the latest ST release from meta-st-x-linux-rt layer. Signed-off-by: Mike Engel --- ...tch => 0010-Rebase-on-v6.6.116-rt66.patch} | 639 ++++++++---------- .../0011-v6.6-stm32mp-rt-r2.patch | 515 -------------- .../0011-v6.6-stm32mp-rt-r3.patch | 321 +++++++++ .../recipes-kernel/linux/linux-dey_6.6.bb | 4 +- 4 files changed, 610 insertions(+), 869 deletions(-) rename meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/{0010-Rebase-on-v6.6.78-rt51.patch => 0010-Rebase-on-v6.6.116-rt66.patch} (97%) delete mode 100644 meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0011-v6.6-stm32mp-rt-r2.patch create mode 100644 meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0011-v6.6-stm32mp-rt-r3.patch diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0010-Rebase-on-v6.6.78-rt51.patch b/meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0010-Rebase-on-v6.6.116-rt66.patch similarity index 97% rename from meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0010-Rebase-on-v6.6.78-rt51.patch rename to meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0010-Rebase-on-v6.6.116-rt66.patch index d0ce62e1e..d9d13b38d 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0010-Rebase-on-v6.6.78-rt51.patch +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0010-Rebase-on-v6.6.116-rt66.patch @@ -1,11 +1,10 @@ -From 1ffab13b34f094b8a6283ccaaa5f9c659e3a2b4f Mon Sep 17 00:00:00 2001 +From f24970a4ec5a2627745aead3ea260a1b3fae4dbf Mon Sep 17 00:00:00 2001 From: Christophe Priouzeau -Date: Tue, 22 Apr 2025 10:43:43 +0200 -Subject: Rebase-on-v6.6.78-rt51 +Date: Tue, 16 Dec 2025 13:44:16 +0100 +Subject: [PATCH 1/2] Rebase-on-v6.6.116-rt66 ---- Upstream-Status: Backport - +--- arch/arm/Kconfig | 6 +- arch/arm/mm/fault.c | 6 + arch/arm/vfp/vfpmodule.c | 74 +- @@ -17,7 +16,7 @@ Upstream-Status: Backport arch/powerpc/platforms/pseries/Kconfig | 1 + arch/powerpc/platforms/pseries/iommu.c | 31 +- arch/riscv/Kconfig | 2 + - arch/riscv/include/asm/cpufeature.h | 2 - + arch/riscv/include/asm/cpufeature.h | 1 - arch/riscv/include/asm/thread_info.h | 2 + arch/riscv/kernel/cpufeature.c | 92 +- arch/riscv/kernel/smpboot.c | 1 - @@ -51,7 +50,7 @@ Upstream-Status: Backport drivers/tty/serial/8250/8250_mtk.c | 8 +- drivers/tty/serial/8250/8250_omap.c | 52 +- drivers/tty/serial/8250/8250_pci1xxxx.c | 8 +- - drivers/tty/serial/8250/8250_port.c | 259 +- + drivers/tty/serial/8250/8250_port.c | 257 +- drivers/tty/serial/altera_jtaguart.c | 28 +- drivers/tty/serial/altera_uart.c | 20 +- drivers/tty/serial/amba-pl010.c | 20 +- @@ -103,7 +102,7 @@ Upstream-Status: Backport drivers/tty/serial/sifive.c | 25 +- drivers/tty/serial/sprd_serial.c | 30 +- drivers/tty/serial/st-asc.c | 18 +- - drivers/tty/serial/stm32-usart.c | 58 +- + drivers/tty/serial/stm32-usart.c | 38 +- drivers/tty/serial/sunhv.c | 28 +- drivers/tty/serial/sunplus-uart.c | 26 +- drivers/tty/serial/sunsab.c | 34 +- @@ -116,7 +115,6 @@ Upstream-Status: Backport drivers/tty/serial/xilinx_uartps.c | 52 +- drivers/tty/tty_io.c | 11 +- fs/proc/consoles.c | 14 +- - git.info | 10 + include/linux/bottom_half.h | 2 + include/linux/console.h | 150 + include/linux/entry-common.h | 2 +- @@ -171,8 +169,7 @@ Upstream-Status: Backport localversion-rt | 1 + net/core/dev.c | 39 +- net/core/skbuff.c | 7 +- - 165 files changed, 8115 insertions(+), 1505 deletions(-) - create mode 100644 git.info + 164 files changed, 8081 insertions(+), 1506 deletions(-) create mode 100644 kernel/printk/nbcon.c create mode 100644 kernel/sched/rt.c.orig create mode 100644 localversion-rt @@ -216,10 +213,10 @@ index 57c0448d0..e5a283851 100644 select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_RSEQ diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c -index fef62e4a9..622a30243 100644 +index ed1a25f45..90c9ecd71 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c -@@ -404,6 +404,9 @@ do_translation_fault(unsigned long addr, unsigned int fsr, +@@ -411,6 +411,9 @@ do_translation_fault(unsigned long addr, unsigned int fsr, if (addr < TASK_SIZE) return do_page_fault(addr, fsr, regs); @@ -229,7 +226,7 @@ index fef62e4a9..622a30243 100644 if (user_mode(regs)) goto bad_area; -@@ -474,6 +477,9 @@ do_translation_fault(unsigned long addr, unsigned int fsr, +@@ -481,6 +484,9 @@ do_translation_fault(unsigned long addr, unsigned int fsr, static int do_sect_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) { @@ -439,7 +436,7 @@ index 7e8773a2d..9fde36fcb 100644 EXPORT_SYMBOL(kernel_neon_end); diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig -index 658c6a61a..f5d5c265f 100644 +index 1be9f1f6b..ef8c4dfc0 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -97,6 +97,7 @@ config ARM64 @@ -537,7 +534,7 @@ index 4ebf2ef28..381c3be3b 100644 select MPIC select OF_DYNAMIC diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c -index b1e6d275c..9a8d3970d 100644 +index bf02f94a9..eb4bd4b6e 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -25,6 +25,7 @@ @@ -652,15 +649,16 @@ index 130499223..391adf8ff 100644 select HAVE_RETHOOK if !XIP_KERNEL select HAVE_RSEQ diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h -index d0345bd65..23fed53b8 100644 +index 13b7d3564..788fd575c 100644 --- a/arch/riscv/include/asm/cpufeature.h +++ b/arch/riscv/include/asm/cpufeature.h -@@ -30,6 +30,4 @@ DECLARE_PER_CPU(long, misaligned_access_speed); +@@ -30,7 +30,6 @@ DECLARE_PER_CPU(long, misaligned_access_speed); /* Per-cpu ISA extensions. */ extern struct riscv_isainfo hart_isa[NR_CPUS]; -void check_unaligned_access(int cpu); -- + void riscv_user_isa_enable(void); + #endif diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h index 8c72d1bcd..c59ad9b7a 100644 @@ -683,7 +681,7 @@ index 8c72d1bcd..c59ad9b7a 100644 #define _TIF_WORK_MASK \ (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED | \ diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c -index bb5fb2b82..3f2767c9b 100644 +index 3f0ad09e1..66d2b0455 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -8,6 +8,7 @@ @@ -830,13 +828,13 @@ index bb5fb2b82..3f2767c9b 100644 -arch_initcall(check_unaligned_access_boot_cpu); +arch_initcall(check_unaligned_access_all_cpus); - #ifdef CONFIG_RISCV_ALTERNATIVE - /* + void riscv_user_isa_enable(void) + { diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c -index 1b8da4e40..2cb5e6514 100644 +index d1b0a6fc3..d162bf339 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c -@@ -246,7 +246,6 @@ asmlinkage __visible void smp_callin(void) +@@ -248,7 +248,6 @@ asmlinkage __visible void smp_callin(void) numa_add_cpu(curr_cpuid); set_cpu_online(curr_cpuid, 1); @@ -845,7 +843,7 @@ index 1b8da4e40..2cb5e6514 100644 if (has_vector()) { if (riscv_v_setup_vsize()) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index 05c82fd5d..a29075276 100644 +index 37e22efbd..cd1d6e7a4 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -118,6 +118,7 @@ config X86 @@ -889,7 +887,7 @@ index d63b02940..1ff38ebbd 100644 #define _TIF_SSBD (1 << TIF_SSBD) #define _TIF_SPEC_IB (1 << TIF_SPEC_IB) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c -index 831fa4a12..5af3ebec0 100644 +index b524cf272..d1f9ba39e 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -107,7 +107,7 @@ static const struct dmi_system_id processor_power_dmi_table[] = { @@ -902,7 +900,7 @@ index 831fa4a12..5af3ebec0 100644 raw_local_irq_disable(); } diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c -index b73038ad8..9705d2065 100644 +index 44cf0e51d..adb645de0 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -57,6 +57,41 @@ static void zram_free_page(struct zram *zram, size_t index); @@ -1080,10 +1078,10 @@ index 172aa10a8..4ae472053 100644 + preempt_enable(); } diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c -index d587f807d..5036a3e60 100644 +index 294609557..56c42867b 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c -@@ -2141,9 +2141,17 @@ bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, +@@ -2142,9 +2142,17 @@ bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, bool fast_validate) { bool voltage_supported; @@ -1103,10 +1101,10 @@ index d587f807d..5036a3e60 100644 } diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c -index 8dffa5b64..2cd1742c6 100644 +index 24105a5b9..349c22dac 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c -@@ -953,9 +953,17 @@ static bool dcn21_validate_bandwidth(struct dc *dc, struct dc_state *context, +@@ -954,9 +954,17 @@ static bool dcn21_validate_bandwidth(struct dc *dc, struct dc_state *context, bool fast_validate) { bool voltage_supported; @@ -1817,7 +1815,7 @@ index c536028e9..efb6f1c19 100644 uart_remove_one_port(&serial8250_reg, &uart->port); diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c -index 7fa665017..8b30ca8fd 100644 +index 62492cf10..fb85ef075 100644 --- a/drivers/tty/serial/8250/8250_dma.c +++ b/drivers/tty/serial/8250/8250_dma.c @@ -22,7 +22,7 @@ static void __dma_tx_complete(void *param) @@ -1857,7 +1855,7 @@ index 7fa665017..8b30ca8fd 100644 int serial8250_tx_dma(struct uart_8250_port *p) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c -index eaf4a9073..d12f230f1 100644 +index 57b27f9ea..d67023fb5 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -290,20 +290,20 @@ static int dw8250_handle_irq(struct uart_port *p) @@ -1886,10 +1884,10 @@ index eaf4a9073..d12f230f1 100644 if (status & (UART_LSR_DR | UART_LSR_BI)) { dw8250_writel_ext(p, RZN1_UART_RDMACR, 0); diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c -index 27430fdd9..17be6ad24 100644 +index e79ee33d4..54cbff920 100644 --- a/drivers/tty/serial/8250/8250_exar.c +++ b/drivers/tty/serial/8250/8250_exar.c -@@ -243,9 +243,9 @@ static int xr17v35x_startup(struct uart_port *port) +@@ -245,9 +245,9 @@ static int xr17v35x_startup(struct uart_port *port) * * Synchronize UART_IER access against the console. */ @@ -1929,7 +1927,7 @@ index 6af4e1c12..f522eb502 100644 } diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c -index 28f9a2679..33699e86e 100644 +index c4a2a3e28..c030b6832 100644 --- a/drivers/tty/serial/8250/8250_mtk.c +++ b/drivers/tty/serial/8250/8250_mtk.c @@ -102,7 +102,7 @@ static void mtk8250_dma_rx_complete(void *param) @@ -2199,7 +2197,7 @@ index a3b25779d..53e238c8c 100644 mutex_unlock(&tport->mutex); } diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c -index 2b1b2928e..441f66ba3 100644 +index 23aed9e89..f741f788b 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -557,6 +557,11 @@ static int serial8250_em485_init(struct uart_8250_port *p) @@ -2490,16 +2488,7 @@ index 2b1b2928e..441f66ba3 100644 if (port->irqflags & IRQF_SHARED) enable_irq(port->irq); -@@ -2377,7 +2394,7 @@ int serial8250_do_startup(struct uart_port *port) - */ - serial_port_out(port, UART_LCR, UART_LCR_WLEN8); - -- spin_lock_irqsave(&port->lock, flags); -+ uart_port_lock_irqsave(port, &flags); - if (up->port.flags & UPF_FOURPORT) { - if (!up->port.irq) - up->port.mctrl |= TIOCM_OUT1; -@@ -2423,7 +2440,7 @@ int serial8250_do_startup(struct uart_port *port) +@@ -2422,7 +2439,7 @@ int serial8250_do_startup(struct uart_port *port) } dont_test_tx_en: @@ -2508,7 +2497,7 @@ index 2b1b2928e..441f66ba3 100644 /* * Clear the interrupt registers again for luck, and clear the -@@ -2494,17 +2511,17 @@ void serial8250_do_shutdown(struct uart_port *port) +@@ -2493,17 +2510,17 @@ void serial8250_do_shutdown(struct uart_port *port) * * Synchronize UART_IER access against the console. */ @@ -2529,7 +2518,7 @@ index 2b1b2928e..441f66ba3 100644 if (port->flags & UPF_FOURPORT) { /* reset interrupts on the AST Fourport board */ inb((port->iobase & 0xfe0) | 0x1f); -@@ -2513,7 +2530,7 @@ void serial8250_do_shutdown(struct uart_port *port) +@@ -2512,7 +2529,7 @@ void serial8250_do_shutdown(struct uart_port *port) port->mctrl &= ~TIOCM_OUT2; serial8250_set_mctrl(port, port->mctrl); @@ -2538,7 +2527,7 @@ index 2b1b2928e..441f66ba3 100644 /* * Disable break condition and FIFOs -@@ -2749,14 +2766,14 @@ void serial8250_update_uartclk(struct uart_port *port, unsigned int uartclk) +@@ -2756,14 +2773,14 @@ void serial8250_update_uartclk(struct uart_port *port, unsigned int uartclk) quot = serial8250_get_divisor(port, baud, &frac); serial8250_rpm_get(up); @@ -2555,7 +2544,7 @@ index 2b1b2928e..441f66ba3 100644 serial8250_rpm_put(up); out_unlock: -@@ -2793,7 +2810,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -2800,7 +2817,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, * Synchronize UART_IER access against the console. */ serial8250_rpm_get(up); @@ -2564,7 +2553,7 @@ index 2b1b2928e..441f66ba3 100644 up->lcr = cval; /* Save computed LCR */ -@@ -2896,7 +2913,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -2903,7 +2920,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, serial_port_out(port, UART_FCR, up->fcr); /* set fcr */ } serial8250_set_mctrl(port, port->mctrl); @@ -2573,7 +2562,7 @@ index 2b1b2928e..441f66ba3 100644 serial8250_rpm_put(up); /* Don't rewrite B0 */ -@@ -2919,15 +2936,15 @@ void serial8250_do_set_ldisc(struct uart_port *port, struct ktermios *termios) +@@ -2926,15 +2943,15 @@ void serial8250_do_set_ldisc(struct uart_port *port, struct ktermios *termios) { if (termios->c_line == N_PPS) { port->flags |= UPF_HARDPPS_CD; @@ -2593,7 +2582,7 @@ index 2b1b2928e..441f66ba3 100644 } } } -@@ -3323,6 +3340,11 @@ static void serial8250_console_putchar(struct uart_port *port, unsigned char ch) +@@ -3331,6 +3348,11 @@ static void serial8250_console_putchar(struct uart_port *port, unsigned char ch) wait_for_xmitr(up, UART_LSR_THRE); serial_port_out(port, UART_TX, ch); @@ -2605,7 +2594,7 @@ index 2b1b2928e..441f66ba3 100644 } /* -@@ -3351,6 +3373,7 @@ static void serial8250_console_restore(struct uart_8250_port *up) +@@ -3359,6 +3381,7 @@ static void serial8250_console_restore(struct uart_8250_port *up) serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS); } @@ -2613,7 +2602,7 @@ index 2b1b2928e..441f66ba3 100644 static void fifo_wait_for_lsr(struct uart_8250_port *up, unsigned int count) { unsigned int i; -@@ -3420,15 +3443,15 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, +@@ -3428,15 +3451,15 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, touch_nmi_watchdog(); if (oops_in_progress) @@ -2632,7 +2621,7 @@ index 2b1b2928e..441f66ba3 100644 /* check scratch reg to see if port powered off during system sleep */ if (up->canary && (up->canary != serial_port_in(port, UART_SCR))) { -@@ -3492,8 +3515,137 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, +@@ -3500,8 +3523,137 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, serial8250_modem_status(up); if (locked) @@ -2771,7 +2760,7 @@ index 2b1b2928e..441f66ba3 100644 static unsigned int probe_baud(struct uart_port *port) { -@@ -3512,6 +3664,7 @@ static unsigned int probe_baud(struct uart_port *port) +@@ -3520,6 +3672,7 @@ static unsigned int probe_baud(struct uart_port *port) int serial8250_console_setup(struct uart_port *port, char *options, bool probe) { @@ -2779,7 +2768,7 @@ index 2b1b2928e..441f66ba3 100644 int baud = 9600; int bits = 8; int parity = 'n'; -@@ -3521,6 +3674,8 @@ int serial8250_console_setup(struct uart_port *port, char *options, bool probe) +@@ -3529,6 +3682,8 @@ int serial8250_console_setup(struct uart_port *port, char *options, bool probe) if (!port->iobase && !port->membase) return -ENODEV; @@ -3282,7 +3271,7 @@ index ad4ae19b6..1aa5b2b49 100644 static struct console arc_console = { diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c -index bcca5627a..5a3f2fc47 100644 +index 85559d9b3..32954d797 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -861,7 +861,7 @@ static void atmel_complete_tx_dma(void *arg) @@ -3798,7 +3787,7 @@ index 249cb380c..7fa809a40 100644 /* diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c -index 8bd0f8e45..58c2c460c 100644 +index 70fa1e6ae..686bfb2cf 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -532,9 +532,9 @@ static void lpuart_dma_tx_complete(void *arg) @@ -3951,7 +3940,7 @@ index 8bd0f8e45..58c2c460c 100644 } } -@@ -1802,14 +1802,14 @@ static void lpuart_hw_setup(struct lpuart_port *sport) +@@ -1819,14 +1819,14 @@ static void lpuart_hw_setup(struct lpuart_port *sport) { unsigned long flags; @@ -3968,7 +3957,7 @@ index 8bd0f8e45..58c2c460c 100644 } static int lpuart_startup(struct uart_port *port) -@@ -1859,7 +1859,7 @@ static void lpuart32_hw_setup(struct lpuart_port *sport) +@@ -1876,7 +1876,7 @@ static void lpuart32_hw_setup(struct lpuart_port *sport) { unsigned long flags; @@ -3977,7 +3966,7 @@ index 8bd0f8e45..58c2c460c 100644 lpuart32_hw_disable(sport); -@@ -1869,7 +1869,7 @@ static void lpuart32_hw_setup(struct lpuart_port *sport) +@@ -1886,7 +1886,7 @@ static void lpuart32_hw_setup(struct lpuart_port *sport) lpuart32_setup_watermark_enable(sport); lpuart32_configure(sport); @@ -3986,7 +3975,7 @@ index 8bd0f8e45..58c2c460c 100644 } static int lpuart32_startup(struct uart_port *port) -@@ -1932,7 +1932,7 @@ static void lpuart_shutdown(struct uart_port *port) +@@ -1949,7 +1949,7 @@ static void lpuart_shutdown(struct uart_port *port) unsigned char temp; unsigned long flags; @@ -3995,7 +3984,7 @@ index 8bd0f8e45..58c2c460c 100644 /* disable Rx/Tx and interrupts */ temp = readb(port->membase + UARTCR2); -@@ -1940,7 +1940,7 @@ static void lpuart_shutdown(struct uart_port *port) +@@ -1957,7 +1957,7 @@ static void lpuart_shutdown(struct uart_port *port) UARTCR2_TIE | UARTCR2_TCIE | UARTCR2_RIE); writeb(temp, port->membase + UARTCR2); @@ -4004,7 +3993,7 @@ index 8bd0f8e45..58c2c460c 100644 lpuart_dma_shutdown(sport); } -@@ -1952,7 +1952,7 @@ static void lpuart32_shutdown(struct uart_port *port) +@@ -1969,7 +1969,7 @@ static void lpuart32_shutdown(struct uart_port *port) unsigned long temp; unsigned long flags; @@ -4013,7 +4002,7 @@ index 8bd0f8e45..58c2c460c 100644 /* clear status */ temp = lpuart32_read(&sport->port, UARTSTAT); -@@ -1969,7 +1969,7 @@ static void lpuart32_shutdown(struct uart_port *port) +@@ -1986,7 +1986,7 @@ static void lpuart32_shutdown(struct uart_port *port) UARTCTRL_TIE | UARTCTRL_TCIE | UARTCTRL_RIE | UARTCTRL_SBK); lpuart32_write(port, temp, UARTCTRL); @@ -4022,7 +4011,7 @@ index 8bd0f8e45..58c2c460c 100644 lpuart_dma_shutdown(sport); } -@@ -2069,7 +2069,7 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -2086,7 +2086,7 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, if (old && sport->lpuart_dma_rx_use) lpuart_dma_rx_free(&sport->port); @@ -4031,7 +4020,7 @@ index 8bd0f8e45..58c2c460c 100644 sport->port.read_status_mask = 0; if (termios->c_iflag & INPCK) -@@ -2124,7 +2124,7 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -2141,7 +2141,7 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, sport->lpuart_dma_rx_use = false; } @@ -4040,7 +4029,7 @@ index 8bd0f8e45..58c2c460c 100644 } static void __lpuart32_serial_setbrg(struct uart_port *port, -@@ -2304,7 +2304,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -2321,7 +2321,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, if (old && sport->lpuart_dma_rx_use) lpuart_dma_rx_free(&sport->port); @@ -4049,7 +4038,7 @@ index 8bd0f8e45..58c2c460c 100644 sport->port.read_status_mask = 0; if (termios->c_iflag & INPCK) -@@ -2362,7 +2362,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -2379,7 +2379,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, sport->lpuart_dma_rx_use = false; } @@ -4058,7 +4047,7 @@ index 8bd0f8e45..58c2c460c 100644 } static const char *lpuart_type(struct uart_port *port) -@@ -2480,9 +2480,9 @@ lpuart_console_write(struct console *co, const char *s, unsigned int count) +@@ -2497,9 +2497,9 @@ lpuart_console_write(struct console *co, const char *s, unsigned int count) int locked = 1; if (oops_in_progress) @@ -4070,7 +4059,7 @@ index 8bd0f8e45..58c2c460c 100644 /* first save CR2 and then disable interrupts */ cr2 = old_cr2 = readb(sport->port.membase + UARTCR2); -@@ -2498,7 +2498,7 @@ lpuart_console_write(struct console *co, const char *s, unsigned int count) +@@ -2515,7 +2515,7 @@ lpuart_console_write(struct console *co, const char *s, unsigned int count) writeb(old_cr2, sport->port.membase + UARTCR2); if (locked) @@ -4079,7 +4068,7 @@ index 8bd0f8e45..58c2c460c 100644 } static void -@@ -2510,9 +2510,9 @@ lpuart32_console_write(struct console *co, const char *s, unsigned int count) +@@ -2527,9 +2527,9 @@ lpuart32_console_write(struct console *co, const char *s, unsigned int count) int locked = 1; if (oops_in_progress) @@ -4091,7 +4080,7 @@ index 8bd0f8e45..58c2c460c 100644 /* first save CR2 and then disable interrupts */ cr = old_cr = lpuart32_read(&sport->port, UARTCTRL); -@@ -2528,7 +2528,7 @@ lpuart32_console_write(struct console *co, const char *s, unsigned int count) +@@ -2545,7 +2545,7 @@ lpuart32_console_write(struct console *co, const char *s, unsigned int count) lpuart32_write(&sport->port, old_cr, UARTCTRL); if (locked) @@ -4100,7 +4089,7 @@ index 8bd0f8e45..58c2c460c 100644 } /* -@@ -3093,7 +3093,7 @@ static int lpuart_suspend(struct device *dev) +@@ -3110,7 +3110,7 @@ static int lpuart_suspend(struct device *dev) uart_suspend_port(&lpuart_reg, &sport->port); if (lpuart_uport_is_active(sport)) { @@ -4109,7 +4098,7 @@ index 8bd0f8e45..58c2c460c 100644 if (lpuart_is_32(sport)) { /* disable Rx/Tx and interrupts */ temp = lpuart32_read(&sport->port, UARTCTRL); -@@ -3105,7 +3105,7 @@ static int lpuart_suspend(struct device *dev) +@@ -3122,7 +3122,7 @@ static int lpuart_suspend(struct device *dev) temp &= ~(UARTCR2_TE | UARTCR2_TIE | UARTCR2_TCIE); writeb(temp, sport->port.membase + UARTCR2); } @@ -4118,7 +4107,7 @@ index 8bd0f8e45..58c2c460c 100644 if (sport->lpuart_dma_rx_use) { /* -@@ -3118,7 +3118,7 @@ static int lpuart_suspend(struct device *dev) +@@ -3135,7 +3135,7 @@ static int lpuart_suspend(struct device *dev) lpuart_dma_rx_free(&sport->port); /* Disable Rx DMA to use UART port as wakeup source */ @@ -4127,7 +4116,7 @@ index 8bd0f8e45..58c2c460c 100644 if (lpuart_is_32(sport)) { temp = lpuart32_read(&sport->port, UARTBAUD); lpuart32_write(&sport->port, temp & ~UARTBAUD_RDMAE, -@@ -3127,11 +3127,11 @@ static int lpuart_suspend(struct device *dev) +@@ -3144,11 +3144,11 @@ static int lpuart_suspend(struct device *dev) writeb(readb(sport->port.membase + UARTCR5) & ~UARTCR5_RDMAS, sport->port.membase + UARTCR5); } @@ -4141,7 +4130,7 @@ index 8bd0f8e45..58c2c460c 100644 if (lpuart_is_32(sport)) { temp = lpuart32_read(&sport->port, UARTBAUD); temp &= ~UARTBAUD_TDMAE; -@@ -3141,7 +3141,7 @@ static int lpuart_suspend(struct device *dev) +@@ -3158,7 +3158,7 @@ static int lpuart_suspend(struct device *dev) temp &= ~UARTCR5_TDMAS; writeb(temp, sport->port.membase + UARTCR5); } @@ -4266,10 +4255,10 @@ index 819f957b6..a75eafbcb 100644 static const char *icom_type(struct uart_port *port) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c -index 349d4849b..3934ab8fe 100644 +index 60d48d857..6db6daffd 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c -@@ -586,7 +586,7 @@ static void imx_uart_dma_tx_callback(void *data) +@@ -587,7 +587,7 @@ static void imx_uart_dma_tx_callback(void *data) unsigned long flags; u32 ucr1; @@ -4278,7 +4267,7 @@ index 349d4849b..3934ab8fe 100644 dma_unmap_sg(sport->port.dev, sgl, sport->dma_tx_nents, DMA_TO_DEVICE); -@@ -611,7 +611,7 @@ static void imx_uart_dma_tx_callback(void *data) +@@ -612,7 +612,7 @@ static void imx_uart_dma_tx_callback(void *data) imx_uart_writel(sport, ucr4, UCR4); } @@ -4287,7 +4276,7 @@ index 349d4849b..3934ab8fe 100644 } /* called with port.lock taken and irqs off */ -@@ -797,11 +797,11 @@ static irqreturn_t imx_uart_rtsint(int irq, void *dev_id) +@@ -798,11 +798,11 @@ static irqreturn_t imx_uart_rtsint(int irq, void *dev_id) struct imx_port *sport = dev_id; irqreturn_t ret; @@ -4301,7 +4290,7 @@ index 349d4849b..3934ab8fe 100644 return ret; } -@@ -810,9 +810,9 @@ static irqreturn_t imx_uart_txint(int irq, void *dev_id) +@@ -811,9 +811,9 @@ static irqreturn_t imx_uart_txint(int irq, void *dev_id) { struct imx_port *sport = dev_id; @@ -4313,7 +4302,7 @@ index 349d4849b..3934ab8fe 100644 return IRQ_HANDLED; } -@@ -926,11 +926,11 @@ static irqreturn_t imx_uart_rxint(int irq, void *dev_id) +@@ -927,11 +927,11 @@ static irqreturn_t imx_uart_rxint(int irq, void *dev_id) struct imx_port *sport = dev_id; irqreturn_t ret; @@ -4327,7 +4316,7 @@ index 349d4849b..3934ab8fe 100644 return ret; } -@@ -993,7 +993,7 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) +@@ -994,7 +994,7 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) unsigned int usr1, usr2, ucr1, ucr2, ucr3, ucr4; irqreturn_t ret = IRQ_NONE; @@ -4336,7 +4325,7 @@ index 349d4849b..3934ab8fe 100644 usr1 = imx_uart_readl(sport, USR1); usr2 = imx_uart_readl(sport, USR2); -@@ -1063,7 +1063,7 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) +@@ -1064,7 +1064,7 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) ret = IRQ_HANDLED; } @@ -4345,7 +4334,7 @@ index 349d4849b..3934ab8fe 100644 return ret; } -@@ -1146,7 +1146,7 @@ static void imx_uart_break_ctl(struct uart_port *port, int break_state) +@@ -1147,7 +1147,7 @@ static void imx_uart_break_ctl(struct uart_port *port, int break_state) unsigned long flags; u32 ucr1; @@ -4354,7 +4343,7 @@ index 349d4849b..3934ab8fe 100644 ucr1 = imx_uart_readl(sport, UCR1) & ~UCR1_SNDBRK; -@@ -1155,7 +1155,7 @@ static void imx_uart_break_ctl(struct uart_port *port, int break_state) +@@ -1156,7 +1156,7 @@ static void imx_uart_break_ctl(struct uart_port *port, int break_state) imx_uart_writel(sport, ucr1, UCR1); @@ -4363,7 +4352,7 @@ index 349d4849b..3934ab8fe 100644 } /* -@@ -1168,9 +1168,9 @@ static void imx_uart_timeout(struct timer_list *t) +@@ -1169,9 +1169,9 @@ static void imx_uart_timeout(struct timer_list *t) unsigned long flags; if (sport->port.state) { @@ -4375,7 +4364,7 @@ index 349d4849b..3934ab8fe 100644 mod_timer(&sport->timer, jiffies + MCTRL_TIMEOUT); } -@@ -1200,9 +1200,9 @@ static void imx_uart_dma_rx_callback(void *data) +@@ -1201,9 +1201,9 @@ static void imx_uart_dma_rx_callback(void *data) status = dmaengine_tx_status(chan, sport->rx_cookie, &state); if (status == DMA_ERROR) { @@ -4387,7 +4376,7 @@ index 349d4849b..3934ab8fe 100644 return; } -@@ -1231,9 +1231,9 @@ static void imx_uart_dma_rx_callback(void *data) +@@ -1232,9 +1232,9 @@ static void imx_uart_dma_rx_callback(void *data) r_bytes = rx_ring->head - rx_ring->tail; /* If we received something, check for 0xff flood */ @@ -4399,7 +4388,7 @@ index 349d4849b..3934ab8fe 100644 if (!(sport->port.ignore_status_mask & URXD_DUMMY_READ)) { -@@ -1491,7 +1491,7 @@ static int imx_uart_startup(struct uart_port *port) +@@ -1498,7 +1498,7 @@ static int imx_uart_startup(struct uart_port *port) if (!uart_console(port) && imx_uart_dma_init(sport) == 0) dma_is_inited = 1; @@ -4408,7 +4397,7 @@ index 349d4849b..3934ab8fe 100644 /* Reset fifo's and state machines */ imx_uart_soft_reset(sport); -@@ -1564,7 +1564,7 @@ static int imx_uart_startup(struct uart_port *port) +@@ -1571,7 +1571,7 @@ static int imx_uart_startup(struct uart_port *port) imx_uart_disable_loopback_rs485(sport); @@ -4417,7 +4406,7 @@ index 349d4849b..3934ab8fe 100644 return 0; } -@@ -1589,21 +1589,21 @@ static void imx_uart_shutdown(struct uart_port *port) +@@ -1596,21 +1596,21 @@ static void imx_uart_shutdown(struct uart_port *port) sport->dma_is_rxing = 0; } @@ -4431,7 +4420,7 @@ index 349d4849b..3934ab8fe 100644 imx_uart_dma_exit(sport); } - mctrl_gpio_disable_ms(sport->gpios); + mctrl_gpio_disable_ms_sync(sport->gpios); - spin_lock_irqsave(&sport->port.lock, flags); + uart_port_lock_irqsave(&sport->port, &flags); @@ -4443,7 +4432,7 @@ index 349d4849b..3934ab8fe 100644 /* * Stop our timer. -@@ -1614,7 +1614,7 @@ static void imx_uart_shutdown(struct uart_port *port) +@@ -1621,7 +1621,7 @@ static void imx_uart_shutdown(struct uart_port *port) * Disable all interrupts, port and break condition. */ @@ -4452,7 +4441,7 @@ index 349d4849b..3934ab8fe 100644 ucr1 = imx_uart_readl(sport, UCR1); ucr1 &= ~(UCR1_TRDYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_RXDMAEN | -@@ -1636,7 +1636,7 @@ static void imx_uart_shutdown(struct uart_port *port) +@@ -1643,7 +1643,7 @@ static void imx_uart_shutdown(struct uart_port *port) ucr4 &= ~UCR4_TCEN; imx_uart_writel(sport, ucr4, UCR4); @@ -4461,7 +4450,7 @@ index 349d4849b..3934ab8fe 100644 clk_disable_unprepare(sport->clk_per); clk_disable_unprepare(sport->clk_ipg); -@@ -1699,7 +1699,7 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -1706,7 +1706,7 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 16); quot = uart_get_divisor(port, baud); @@ -4470,7 +4459,7 @@ index 349d4849b..3934ab8fe 100644 /* * Read current UCR2 and save it for future use, then clear all the bits -@@ -1827,7 +1827,7 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -1834,7 +1834,7 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, if (UART_ENABLE_MS(&sport->port, termios->c_cflag)) imx_uart_enable_ms(&sport->port); @@ -4479,16 +4468,16 @@ index 349d4849b..3934ab8fe 100644 } static const char *imx_uart_type(struct uart_port *port) -@@ -1889,7 +1889,7 @@ static int imx_uart_poll_init(struct uart_port *port) +@@ -1896,7 +1896,7 @@ static int imx_uart_poll_init(struct uart_port *port) - imx_uart_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT); + imx_uart_setup_ufcr(sport, TXTL_DEFAULT, sport->rxtl); - spin_lock_irqsave(&sport->port.lock, flags); + uart_port_lock_irqsave(&sport->port, &flags); /* * Be careful about the order of enabling bits here. First enable the -@@ -1917,7 +1917,7 @@ static int imx_uart_poll_init(struct uart_port *port) +@@ -1924,7 +1924,7 @@ static int imx_uart_poll_init(struct uart_port *port) imx_uart_writel(sport, ucr1 | UCR1_RRDYEN, UCR1); imx_uart_writel(sport, ucr2 | UCR2_ATEN, UCR2); @@ -4497,7 +4486,7 @@ index 349d4849b..3934ab8fe 100644 return 0; } -@@ -2037,9 +2037,9 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count) +@@ -2044,9 +2044,9 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count) if (sport->port.sysrq) locked = 0; else if (oops_in_progress) @@ -4509,7 +4498,7 @@ index 349d4849b..3934ab8fe 100644 /* * First, save UCR1/2/3 and then disable interrupts -@@ -2067,7 +2067,7 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count) +@@ -2074,7 +2074,7 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count) imx_uart_ucrs_restore(sport, &old_ucr); if (locked) @@ -4518,7 +4507,7 @@ index 349d4849b..3934ab8fe 100644 } /* -@@ -2225,10 +2225,10 @@ static enum hrtimer_restart imx_trigger_start_tx(struct hrtimer *t) +@@ -2232,10 +2232,10 @@ static enum hrtimer_restart imx_trigger_start_tx(struct hrtimer *t) struct imx_port *sport = container_of(t, struct imx_port, trigger_start_tx); unsigned long flags; @@ -4531,7 +4520,7 @@ index 349d4849b..3934ab8fe 100644 return HRTIMER_NORESTART; } -@@ -2238,10 +2238,10 @@ static enum hrtimer_restart imx_trigger_stop_tx(struct hrtimer *t) +@@ -2245,10 +2245,10 @@ static enum hrtimer_restart imx_trigger_stop_tx(struct hrtimer *t) struct imx_port *sport = container_of(t, struct imx_port, trigger_stop_tx); unsigned long flags; @@ -4544,7 +4533,7 @@ index 349d4849b..3934ab8fe 100644 return HRTIMER_NORESTART; } -@@ -2508,9 +2508,9 @@ static void imx_uart_restore_context(struct imx_port *sport) +@@ -2515,9 +2515,9 @@ static void imx_uart_restore_context(struct imx_port *sport) { unsigned long flags; @@ -4556,7 +4545,7 @@ index 349d4849b..3934ab8fe 100644 return; } -@@ -2525,7 +2525,7 @@ static void imx_uart_restore_context(struct imx_port *sport) +@@ -2532,7 +2532,7 @@ static void imx_uart_restore_context(struct imx_port *sport) imx_uart_writel(sport, sport->saved_reg[2], UCR3); imx_uart_writel(sport, sport->saved_reg[3], UCR4); sport->context_saved = false; @@ -4565,7 +4554,7 @@ index 349d4849b..3934ab8fe 100644 } static void imx_uart_save_context(struct imx_port *sport) -@@ -2533,7 +2533,7 @@ static void imx_uart_save_context(struct imx_port *sport) +@@ -2540,7 +2540,7 @@ static void imx_uart_save_context(struct imx_port *sport) unsigned long flags; /* Save necessary regs */ @@ -4574,7 +4563,7 @@ index 349d4849b..3934ab8fe 100644 sport->saved_reg[0] = imx_uart_readl(sport, UCR1); sport->saved_reg[1] = imx_uart_readl(sport, UCR2); sport->saved_reg[2] = imx_uart_readl(sport, UCR3); -@@ -2545,7 +2545,7 @@ static void imx_uart_save_context(struct imx_port *sport) +@@ -2552,7 +2552,7 @@ static void imx_uart_save_context(struct imx_port *sport) sport->saved_reg[8] = imx_uart_readl(sport, UBMR); sport->saved_reg[9] = imx_uart_readl(sport, IMX21_UTS); sport->context_saved = true; @@ -4749,7 +4738,7 @@ index 0c78f6627..2bd640428 100644 } diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c -index 222afc270..ce0fef7e2 100644 +index 1bee624bd..be2f13069 100644 --- a/drivers/tty/serial/jsm/jsm_tty.c +++ b/drivers/tty/serial/jsm/jsm_tty.c @@ -152,14 +152,14 @@ static void jsm_tty_send_xchar(struct uart_port *port, char ch) @@ -5350,7 +5339,7 @@ index 9388b9dde..4c1d2089a 100644 } diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbeaut_usio.c -index 70a910085..db3b81f2a 100644 +index 9de3883a4..cd789c99e 100644 --- a/drivers/tty/serial/milbeaut_usio.c +++ b/drivers/tty/serial/milbeaut_usio.c @@ -207,9 +207,9 @@ static irqreturn_t mlb_usio_rx_irq(int irq, void *dev_id) @@ -5535,7 +5524,7 @@ index ea5a7911c..2a4c09f3a 100644 if (tty_termios_baud_rate(termios)) tty_termios_encode_baud_rate(termios, baud, baud); diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c -index 90953e679..597264b54 100644 +index 76b6429fb..2dfc7bc80 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -444,7 +444,7 @@ static void msm_complete_tx_dma(void *args) @@ -6016,7 +6005,7 @@ index e99970a94..919f5e5aa 100644 local_irq_restore(flags); } diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c -index cc83b772b..436cc6d52 100644 +index 7b868ea48..b6fda8cc9 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -1347,7 +1347,7 @@ static void pch_uart_set_termios(struct uart_port *port, @@ -7498,7 +7487,7 @@ index 8ff0efac6..398104760 100644 uart_rs485_config(port); diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c -index 7d5aaa8d4..e51ca593a 100644 +index d5fb293dd..e9e166045 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -184,7 +184,7 @@ static irqreturn_t mctrl_gpio_irq_handle(int irq, void *context) @@ -7520,7 +7509,7 @@ index 7d5aaa8d4..e51ca593a 100644 return IRQ_HANDLED; } diff --git a/drivers/tty/serial/serial_port.c b/drivers/tty/serial/serial_port.c -index 469ad26cd..66fd117d8 100644 +index a21c28707..a871acc51 100644 --- a/drivers/tty/serial/serial_port.c +++ b/drivers/tty/serial/serial_port.c @@ -38,14 +38,14 @@ static int serial_port_runtime_resume(struct device *dev) @@ -7639,10 +7628,10 @@ index be08fb6f7..eaa980722 100644 static void diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c -index 4350a69d9..9f8e224e1 100644 +index dab5658d9..4e4ec5693 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c -@@ -1206,7 +1206,7 @@ static void sci_dma_tx_complete(void *arg) +@@ -1227,7 +1227,7 @@ static void sci_dma_tx_complete(void *arg) dev_dbg(port->dev, "%s(%d)\n", __func__, port->line); @@ -7651,7 +7640,7 @@ index 4350a69d9..9f8e224e1 100644 uart_xmit_advance(port, s->tx_dma_len); -@@ -1230,7 +1230,7 @@ static void sci_dma_tx_complete(void *arg) +@@ -1253,7 +1253,7 @@ static void sci_dma_tx_complete(void *arg) } } @@ -7660,7 +7649,7 @@ index 4350a69d9..9f8e224e1 100644 } /* Locking: called with port lock held */ -@@ -1326,7 +1326,7 @@ static void sci_dma_rx_complete(void *arg) +@@ -1349,7 +1349,7 @@ static void sci_dma_rx_complete(void *arg) dev_dbg(port->dev, "%s(%d) active cookie %d\n", __func__, port->line, s->active_rx); @@ -7669,7 +7658,7 @@ index 4350a69d9..9f8e224e1 100644 active = sci_dma_rx_find_active(s); if (active >= 0) -@@ -1353,20 +1353,20 @@ static void sci_dma_rx_complete(void *arg) +@@ -1376,20 +1376,20 @@ static void sci_dma_rx_complete(void *arg) dma_async_issue_pending(chan); @@ -7694,7 +7683,7 @@ index 4350a69d9..9f8e224e1 100644 } static void sci_dma_tx_release(struct sci_port *s) -@@ -1415,13 +1415,13 @@ static int sci_dma_rx_submit(struct sci_port *s, bool port_lock_held) +@@ -1438,13 +1438,13 @@ static int sci_dma_rx_submit(struct sci_port *s, bool port_lock_held) fail: /* Switch to PIO */ if (!port_lock_held) @@ -7710,7 +7699,7 @@ index 4350a69d9..9f8e224e1 100644 return -EAGAIN; } -@@ -1443,14 +1443,14 @@ static void sci_dma_tx_work_fn(struct work_struct *work) +@@ -1466,14 +1466,14 @@ static void sci_dma_tx_work_fn(struct work_struct *work) * transmit till the end, and then the rest. Take the port lock to get a * consistent xmit buffer state. */ @@ -7727,7 +7716,7 @@ index 4350a69d9..9f8e224e1 100644 return; } -@@ -1458,7 +1458,7 @@ static void sci_dma_tx_work_fn(struct work_struct *work) +@@ -1481,7 +1481,7 @@ static void sci_dma_tx_work_fn(struct work_struct *work) DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); if (!desc) { @@ -7736,7 +7725,7 @@ index 4350a69d9..9f8e224e1 100644 dev_warn(port->dev, "Failed preparing Tx DMA descriptor\n"); goto switch_to_pio; } -@@ -1470,12 +1470,12 @@ static void sci_dma_tx_work_fn(struct work_struct *work) +@@ -1493,12 +1493,12 @@ static void sci_dma_tx_work_fn(struct work_struct *work) desc->callback_param = s; s->cookie_tx = dmaengine_submit(desc); if (dma_submit_error(s->cookie_tx)) { @@ -7751,7 +7740,7 @@ index 4350a69d9..9f8e224e1 100644 dev_dbg(port->dev, "%s: %p: %d...%d, cookie %d\n", __func__, xmit->buf, tail, head, s->cookie_tx); -@@ -1483,10 +1483,10 @@ static void sci_dma_tx_work_fn(struct work_struct *work) +@@ -1506,10 +1506,10 @@ static void sci_dma_tx_work_fn(struct work_struct *work) return; switch_to_pio: @@ -7764,7 +7753,7 @@ index 4350a69d9..9f8e224e1 100644 return; } -@@ -1503,17 +1503,17 @@ static enum hrtimer_restart sci_dma_rx_timer_fn(struct hrtimer *t) +@@ -1526,17 +1526,17 @@ static enum hrtimer_restart sci_dma_rx_timer_fn(struct hrtimer *t) dev_dbg(port->dev, "DMA Rx timed out\n"); @@ -7785,7 +7774,7 @@ index 4350a69d9..9f8e224e1 100644 dev_dbg(port->dev, "Cookie %d #%d has already completed\n", s->active_rx, active); -@@ -1531,7 +1531,7 @@ static enum hrtimer_restart sci_dma_rx_timer_fn(struct hrtimer *t) +@@ -1554,7 +1554,7 @@ static enum hrtimer_restart sci_dma_rx_timer_fn(struct hrtimer *t) */ status = dmaengine_tx_status(s->chan_rx, s->active_rx, &state); if (status == DMA_COMPLETE) { @@ -7794,7 +7783,7 @@ index 4350a69d9..9f8e224e1 100644 dev_dbg(port->dev, "Transaction complete after DMA engine was stopped"); return HRTIMER_NORESTART; } -@@ -1552,7 +1552,7 @@ static enum hrtimer_restart sci_dma_rx_timer_fn(struct hrtimer *t) +@@ -1575,7 +1575,7 @@ static enum hrtimer_restart sci_dma_rx_timer_fn(struct hrtimer *t) sci_dma_rx_reenable_irq(s); @@ -7803,7 +7792,7 @@ index 4350a69d9..9f8e224e1 100644 return HRTIMER_NORESTART; } -@@ -1776,9 +1776,9 @@ static irqreturn_t sci_tx_interrupt(int irq, void *ptr) +@@ -1816,9 +1816,9 @@ static irqreturn_t sci_tx_interrupt(int irq, void *ptr) struct uart_port *port = ptr; unsigned long flags; @@ -7815,7 +7804,7 @@ index 4350a69d9..9f8e224e1 100644 return IRQ_HANDLED; } -@@ -1792,11 +1792,11 @@ static irqreturn_t sci_tx_end_interrupt(int irq, void *ptr) +@@ -1832,11 +1832,11 @@ static irqreturn_t sci_tx_end_interrupt(int irq, void *ptr) if (port->type != PORT_SCI) return sci_tx_interrupt(irq, ptr); @@ -7829,7 +7818,7 @@ index 4350a69d9..9f8e224e1 100644 return IRQ_HANDLED; } -@@ -2193,7 +2193,7 @@ static void sci_break_ctl(struct uart_port *port, int break_state) +@@ -2239,7 +2239,7 @@ static void sci_break_ctl(struct uart_port *port, int break_state) return; } @@ -7838,7 +7827,7 @@ index 4350a69d9..9f8e224e1 100644 scsptr = serial_port_in(port, SCSPTR); scscr = serial_port_in(port, SCSCR); -@@ -2207,7 +2207,7 @@ static void sci_break_ctl(struct uart_port *port, int break_state) +@@ -2253,7 +2253,7 @@ static void sci_break_ctl(struct uart_port *port, int break_state) serial_port_out(port, SCSPTR, scsptr); serial_port_out(port, SCSCR, scscr); @@ -7847,16 +7836,16 @@ index 4350a69d9..9f8e224e1 100644 } static int sci_startup(struct uart_port *port) -@@ -2239,7 +2239,7 @@ static void sci_shutdown(struct uart_port *port) +@@ -2286,7 +2286,7 @@ static void sci_shutdown(struct uart_port *port) s->autorts = false; - mctrl_gpio_disable_ms(to_sci_port(port)->gpios); + mctrl_gpio_disable_ms_sync(to_sci_port(port)->gpios); - spin_lock_irqsave(&port->lock, flags); + uart_port_lock_irqsave(port, &flags); sci_stop_rx(port); sci_stop_tx(port); /* -@@ -2249,7 +2249,7 @@ static void sci_shutdown(struct uart_port *port) +@@ -2296,7 +2296,7 @@ static void sci_shutdown(struct uart_port *port) scr = serial_port_in(port, SCSCR); serial_port_out(port, SCSCR, scr & (SCSCR_CKE1 | SCSCR_CKE0 | s->hscif_tot)); @@ -7865,7 +7854,7 @@ index 4350a69d9..9f8e224e1 100644 #ifdef CONFIG_SERIAL_SH_SCI_DMA if (s->chan_rx_saved) { -@@ -2551,7 +2551,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -2598,7 +2598,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, serial_port_out(port, SCCKS, sccks); } @@ -7874,7 +7863,7 @@ index 4350a69d9..9f8e224e1 100644 sci_reset(port); -@@ -2673,7 +2673,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -2720,7 +2720,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, if ((termios->c_cflag & CREAD) != 0) sci_start_rx(port); @@ -7883,7 +7872,7 @@ index 4350a69d9..9f8e224e1 100644 sci_port_disable(s); -@@ -3058,9 +3058,9 @@ static void serial_console_write(struct console *co, const char *s, +@@ -3096,9 +3096,9 @@ static void serial_console_write(struct console *co, const char *s, if (port->sysrq) locked = 0; else if (oops_in_progress) @@ -7895,7 +7884,7 @@ index 4350a69d9..9f8e224e1 100644 /* first save SCSCR then disable interrupts, keep clock source */ ctrl = serial_port_in(port, SCSCR); -@@ -3080,7 +3080,7 @@ static void serial_console_write(struct console *co, const char *s, +@@ -3118,7 +3118,7 @@ static void serial_console_write(struct console *co, const char *s, serial_port_out(port, SCSCR, ctrl); if (locked) @@ -7905,7 +7894,7 @@ index 4350a69d9..9f8e224e1 100644 static int serial_console_setup(struct console *co, char *options) diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c -index d195c5de5..d420bed4a 100644 +index e86b00873..2d7b696fe 100644 --- a/drivers/tty/serial/sifive.c +++ b/drivers/tty/serial/sifive.c @@ -412,7 +412,8 @@ static void __ssp_receive_chars(struct sifive_serial_port *ssp) @@ -7941,7 +7930,7 @@ index d195c5de5..d420bed4a 100644 return IRQ_HANDLED; } -@@ -653,7 +654,7 @@ static void sifive_serial_set_termios(struct uart_port *port, +@@ -659,7 +660,7 @@ static void sifive_serial_set_termios(struct uart_port *port, ssp->port.uartclk / 16); __ssp_update_baud_rate(ssp, rate); @@ -7950,7 +7939,7 @@ index d195c5de5..d420bed4a 100644 /* Update the per-port timeout */ uart_update_timeout(port, termios->c_cflag, rate); -@@ -670,7 +671,7 @@ static void sifive_serial_set_termios(struct uart_port *port, +@@ -676,7 +677,7 @@ static void sifive_serial_set_termios(struct uart_port *port, if (v != old_v) __ssp_writel(v, SIFIVE_SERIAL_RXCTRL_OFFS, ssp); @@ -7959,7 +7948,7 @@ index d195c5de5..d420bed4a 100644 } static void sifive_serial_release_port(struct uart_port *port) -@@ -791,13 +792,10 @@ static void sifive_serial_console_write(struct console *co, const char *s, +@@ -797,13 +798,10 @@ static void sifive_serial_console_write(struct console *co, const char *s, if (!ssp) return; @@ -7976,7 +7965,7 @@ index d195c5de5..d420bed4a 100644 ier = __ssp_readl(ssp, SIFIVE_SERIAL_IE_OFFS); __ssp_writel(0, SIFIVE_SERIAL_IE_OFFS, ssp); -@@ -807,8 +805,7 @@ static void sifive_serial_console_write(struct console *co, const char *s, +@@ -813,8 +811,7 @@ static void sifive_serial_console_write(struct console *co, const char *s, __ssp_writel(ier, SIFIVE_SERIAL_IE_OFFS, ssp); if (locked) @@ -8187,82 +8176,65 @@ index 92b9f6894..a821f5d76 100644 static int asc_console_setup(struct console *co, char *options) diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c -index 5f51d9397..1c949774f 100644 +index 00e0d8d46..77b17b943 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c -@@ -58,6 +58,7 @@ static struct stm32_usart_info __maybe_unused stm32f4_info = { - .cfg = { - .uart_enable_bit = 13, - .has_7bits_data = false, -+ .fifosize = 1, - } - }; - -@@ -81,6 +82,7 @@ static struct stm32_usart_info __maybe_unused stm32f7_info = { - .uart_enable_bit = 0, - .has_7bits_data = true, - .has_swap = true, -+ .fifosize = 1, - } - }; - -@@ -107,6 +109,7 @@ static struct stm32_usart_info __maybe_unused stm32h7_info = { - .has_swap = true, - .has_wakeup = true, - .has_fifo = true, -+ .fifosize = 16, - } - }; - -@@ -189,6 +192,7 @@ static void stm32_usart_config_reg_rs485(u32 *cr1, u32 *cr3, u32 delay_ADE, - u32 delay_DDE, u32 baud) - { - u32 rs485_deat_dedt; -+ u32 rs485_deat_dedt_max = (USART_CR1_DEAT_MASK >> USART_CR1_DEAT_SHIFT); - bool over8; - - *cr3 |= USART_CR3_DEM; -@@ -201,18 +205,24 @@ static void stm32_usart_config_reg_rs485(u32 *cr1, u32 *cr3, u32 delay_ADE, - else - rs485_deat_dedt = delay_ADE * baud * 16; - -- rs485_deat_dedt = DIV_ROUND_UP(rs485_deat_dedt, 1000); -- rs485_deat_dedt = min_t(u32, rs485_deat_dedt, FIELD_MAX(USART_CR1_DEAT_MASK)); -- *cr1 |= FIELD_PREP(USART_CR1_DEAT_MASK, rs485_deat_dedt); -+ rs485_deat_dedt = DIV_ROUND_CLOSEST(rs485_deat_dedt, 1000); -+ rs485_deat_dedt = rs485_deat_dedt > rs485_deat_dedt_max ? -+ rs485_deat_dedt_max : rs485_deat_dedt; -+ rs485_deat_dedt = (rs485_deat_dedt << USART_CR1_DEAT_SHIFT) & -+ USART_CR1_DEAT_MASK; -+ *cr1 |= rs485_deat_dedt; - - if (over8) - rs485_deat_dedt = delay_DDE * baud * 8; - else - rs485_deat_dedt = delay_DDE * baud * 16; - -- rs485_deat_dedt = DIV_ROUND_UP(rs485_deat_dedt, 1000); -- rs485_deat_dedt = min_t(u32, rs485_deat_dedt, FIELD_MAX(USART_CR1_DEDT_MASK)); -- *cr1 |= FIELD_PREP(USART_CR1_DEDT_MASK, rs485_deat_dedt); -+ rs485_deat_dedt = DIV_ROUND_CLOSEST(rs485_deat_dedt, 1000); -+ rs485_deat_dedt = rs485_deat_dedt > rs485_deat_dedt_max ? -+ rs485_deat_dedt_max : rs485_deat_dedt; -+ rs485_deat_dedt = (rs485_deat_dedt << USART_CR1_DEDT_SHIFT) & -+ USART_CR1_DEDT_MASK; -+ *cr1 |= rs485_deat_dedt; - } - - static int stm32_usart_config_rs485(struct uart_port *port, struct ktermios *termios, -@@ -711,7 +721,7 @@ static void stm32_usart_rx_dma_complete(void *arg) +@@ -698,7 +698,7 @@ static void stm32_usart_rx_dma_complete(void *arg) pm_runtime_get(port->dev); - spin_lock_irqsave(&port->lock, flags); + uart_port_lock_irqsave(port, &flags); size = stm32_usart_receive_chars(port, false); - uart_unlock_and_check_sysrq_irqrestore(port, flags); if (size) -@@ -1272,7 +1282,7 @@ static void stm32_usart_throttle(struct uart_port *port) + tty_flip_buffer_push(tport); +@@ -833,7 +833,7 @@ static void stm32_usart_tx_dma_complete(void *arg) + dev_warn(port->dev, "DMA residue not null: residue=%d, in_flight=%d\n", + state.residue, state.in_flight_bytes); + +- spin_lock_irqsave(&port->lock, flags); ++ uart_port_lock_irqsave(port, &flags); + + /* Update TX status */ + uart_xmit_advance(port, count); +@@ -847,7 +847,7 @@ static void stm32_usart_tx_dma_complete(void *arg) + /* Let's see if we have pending data to send */ + stm32_usart_transmit_chars(port); + +- spin_unlock_irqrestore(&port->lock, flags); ++ uart_port_lock_irqsave(port, &flags); + + pm_runtime_mark_last_busy(port->dev); + pm_runtime_put_autosuspend(port->dev); +@@ -1136,7 +1136,7 @@ static irqreturn_t stm32_usart_interrupt(int irq, void *ptr) + if (!stm32_port->throttled) { + if (((sr & USART_SR_RXNE) && !stm32_usart_rx_dma_started(stm32_port)) || + ((sr & USART_SR_ERR_MASK) && stm32_usart_rx_dma_started(stm32_port))) { +- spin_lock(&port->lock); ++ uart_port_lock(port); + size = stm32_usart_receive_chars(port, false); + if (size) + tty_flip_buffer_push(tport); +@@ -1147,15 +1147,15 @@ static irqreturn_t stm32_usart_interrupt(int irq, void *ptr) + } + + if ((sr & USART_SR_TXE) && !(stm32_port->tx_ch)) { +- spin_lock(&port->lock); ++ uart_port_lock(port); + stm32_usart_transmit_chars(port); +- spin_unlock(&port->lock); ++ uart_port_unlock(port); + ret = IRQ_HANDLED; + } + + /* Receiver timeout irq for DMA RX */ + if (stm32_usart_rx_dma_started(stm32_port) && !stm32_port->throttled) { +- spin_lock(&port->lock); ++ uart_port_lock(port); + size = stm32_usart_receive_chars(port, false); + if (size) + tty_flip_buffer_push(tport); +@@ -1276,7 +1276,7 @@ static void stm32_usart_throttle(struct uart_port *port) */ pm_runtime_get(port->dev); @@ -8271,7 +8243,7 @@ index 5f51d9397..1c949774f 100644 /* * Pause DMA transfer, so the RX data gets queued into the FIFO. -@@ -1285,7 +1295,7 @@ static void stm32_usart_throttle(struct uart_port *port) +@@ -1289,7 +1289,7 @@ static void stm32_usart_throttle(struct uart_port *port) stm32_usart_clr_bits(port, ofs->cr3, stm32_port->cr3_irq); stm32_port->throttled = true; @@ -8280,7 +8252,7 @@ index 5f51d9397..1c949774f 100644 } /* Unthrottle the remote, the input buffer can now accept data. */ -@@ -1295,7 +1305,7 @@ static void stm32_usart_unthrottle(struct uart_port *port) +@@ -1299,7 +1299,7 @@ static void stm32_usart_unthrottle(struct uart_port *port) const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; unsigned long flags; @@ -8289,15 +8261,16 @@ index 5f51d9397..1c949774f 100644 stm32_usart_set_bits(port, ofs->cr1, stm32_port->cr1_irq); if (stm32_port->cr3_irq) stm32_usart_set_bits(port, ofs->cr3, stm32_port->cr3_irq); -@@ -1335,6 +1345,7 @@ static void stm32_usart_stop_rx(struct uart_port *port) - pm_runtime_put_autosuspend(port->dev); - } +@@ -1313,7 +1313,7 @@ static void stm32_usart_unthrottle(struct uart_port *port) + if (stm32_port->rx_ch) + stm32_usart_rx_dma_start_or_resume(port); -+/* Handle breaks - ignored by us */ - static void stm32_usart_break_ctl(struct uart_port *port, int break_state) - { - struct stm32_port *stm32_port = to_stm32_port(port); -@@ -1475,7 +1486,7 @@ static void stm32_usart_set_termios(struct uart_port *port, +- spin_unlock_irqrestore(&port->lock, flags); ++ uart_port_unlock_irqrestore(port, flags); + + /* Port is unthrottled, balance pm_runtime */ + pm_runtime_mark_last_busy(port->dev); +@@ -1481,7 +1481,7 @@ static void stm32_usart_set_termios(struct uart_port *port, uart_clk = clk_get_rate(stm32_port->clk); @@ -8306,18 +8279,7 @@ index 5f51d9397..1c949774f 100644 ret = readl_relaxed_poll_timeout_atomic(port->membase + ofs->isr, isr, -@@ -1690,12 +1701,18 @@ static void stm32_usart_set_termios(struct uart_port *port, - cr1 &= ~(USART_CR1_DEDT_MASK | USART_CR1_DEAT_MASK); - } - -+ /* Configure wake up from low power on start bit detection */ -+ if (stm32_port->wakeup_src) { -+ cr3 &= ~USART_CR3_WUS_MASK; -+ cr3 |= USART_CR3_WUS_START_BIT; -+ } -+ - writel_relaxed(cr3, port->membase + ofs->cr3); - writel_relaxed(cr2, port->membase + ofs->cr2); +@@ -1701,7 +1701,7 @@ static void stm32_usart_set_termios(struct uart_port *port, writel_relaxed(cr1, port->membase + ofs->cr1); stm32_usart_set_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit)); @@ -8326,30 +8288,19 @@ index 5f51d9397..1c949774f 100644 /* Handle modem control interrupts */ if (UART_ENABLE_MS(port, termios->c_cflag)) -@@ -1893,6 +1910,7 @@ static int stm32_usart_init_port(struct stm32_port *stm32port, - port->flags = UPF_BOOT_AUTOCONF; - port->ops = &stm32_uart_ops; - port->dev = &pdev->dev; -+ port->fifosize = stm32port->info->cfg.fifosize; - port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_STM32_CONSOLE); - port->irq = irq; - port->rs485_config = stm32_usart_config_rs485; -@@ -1910,6 +1928,14 @@ static int stm32_usart_init_port(struct stm32_port *stm32port, - stm32port->swap = stm32port->info->cfg.has_swap && - of_property_read_bool(pdev->dev.of_node, "rx-tx-swap"); +@@ -1754,9 +1754,9 @@ static void stm32_usart_pm(struct uart_port *port, unsigned int state, + clk_prepare_enable(stm32port->clk); + break; + case UART_PM_STATE_OFF: +- spin_lock_irqsave(&port->lock, flags); ++ uart_port_lock_irqsave(port, &flags); + stm32_usart_clr_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit)); +- spin_unlock_irqrestore(&port->lock, flags); ++ uart_port_unlock_irqrestore(port, flags); -+ stm32port->fifoen = stm32port->info->cfg.has_fifo; -+ if (stm32port->fifoen) { -+ stm32_usart_get_ftcfg(pdev, "rx-threshold", -+ &stm32port->rxftcfg); -+ stm32_usart_get_ftcfg(pdev, "tx-threshold", -+ &stm32port->txftcfg); -+ } -+ - port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(port->membase)) - return PTR_ERR(port->membase); -@@ -2301,9 +2327,9 @@ static void stm32_usart_console_write(struct console *co, const char *s, + clk_disable_unprepare(stm32port->clk); + break; +@@ -2307,9 +2307,9 @@ static void stm32_usart_console_write(struct console *co, const char *s, int locked = 1; if (oops_in_progress) @@ -8361,7 +8312,7 @@ index 5f51d9397..1c949774f 100644 pm_runtime_get(port->dev); -@@ -2322,7 +2348,7 @@ static void stm32_usart_console_write(struct console *co, const char *s, +@@ -2328,7 +2328,7 @@ static void stm32_usart_console_write(struct console *co, const char *s, pm_runtime_put_autosuspend(port->dev); if (locked) @@ -8370,7 +8321,7 @@ index 5f51d9397..1c949774f 100644 } static int stm32_usart_console_setup(struct console *co, char *options) -@@ -2459,7 +2485,7 @@ static int __maybe_unused stm32_usart_serial_en_wakeup(struct uart_port *port, +@@ -2465,7 +2465,7 @@ static int __maybe_unused stm32_usart_serial_en_wakeup(struct uart_port *port, * low-power mode. */ if (stm32_port->rx_ch) { @@ -9136,7 +9087,7 @@ index 0859394a7..0cc6524f5 100644 static const char *timbuart_type(struct uart_port *port) diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c -index b225a78f6..404c14aca 100644 +index 9f39bafa7..9ffe82235 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -216,11 +216,11 @@ static irqreturn_t ulite_isr(int irq, void *dev_id) @@ -9554,22 +9505,6 @@ index e0758fe79..270367654 100644 if (dev) seq_printf(m, " %4d:%d", MAJOR(dev), MINOR(dev)); -diff --git a/git.info b/git.info -new file mode 100644 -index 000000000..b8640a182 ---- /dev/null -+++ b/git.info -@@ -0,0 +1,10 @@ -+devel-rt https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git (fetch) -+devel-rt https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git (push) -+origin https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git (fetch) -+origin https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git (push) -+rt https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git (fetch) -+rt https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git (push) -+stable https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git (fetch) -+stable https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git (push) -+stm32 https://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git (fetch) -+stm32 https://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git (push) diff --git a/include/linux/bottom_half.h b/include/linux/bottom_half.h index fc53e0ad5..448bbef47 100644 --- a/include/linux/bottom_half.h @@ -9586,7 +9521,7 @@ index fc53e0ad5..448bbef47 100644 #endif /* _LINUX_BH_H */ diff --git a/include/linux/console.h b/include/linux/console.h -index 7de11c763..1eb9580e9 100644 +index 385716070..b4d580714 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -16,7 +16,9 @@ @@ -9599,7 +9534,7 @@ index 7de11c763..1eb9580e9 100644 #include struct vc_data; -@@ -156,6 +158,8 @@ static inline int con_debug_leave(void) +@@ -161,6 +163,8 @@ static inline int con_debug_leave(void) * /dev/kmesg which requires a larger output buffer. * @CON_SUSPENDED: Indicates if a console is suspended. If true, the * printing callbacks must not be called. @@ -9608,7 +9543,7 @@ index 7de11c763..1eb9580e9 100644 */ enum cons_flags { CON_PRINTBUFFER = BIT(0), -@@ -166,6 +170,111 @@ enum cons_flags { +@@ -171,6 +175,111 @@ enum cons_flags { CON_BRL = BIT(5), CON_EXTENDED = BIT(6), CON_SUSPENDED = BIT(7), @@ -9720,7 +9655,7 @@ index 7de11c763..1eb9580e9 100644 }; /** -@@ -187,6 +296,17 @@ enum cons_flags { +@@ -192,6 +301,17 @@ enum cons_flags { * @dropped: Number of unreported dropped ringbuffer records * @data: Driver private data * @node: hlist node for the console list @@ -9738,7 +9673,7 @@ index 7de11c763..1eb9580e9 100644 */ struct console { char name[16]; -@@ -206,6 +326,20 @@ struct console { +@@ -211,6 +331,20 @@ struct console { unsigned long dropped; void *data; struct hlist_node node; @@ -9759,7 +9694,7 @@ index 7de11c763..1eb9580e9 100644 }; #ifdef CONFIG_LOCKDEP -@@ -332,6 +466,22 @@ static inline bool console_is_registered(const struct console *con) +@@ -337,6 +471,22 @@ static inline bool console_is_registered(const struct console *con) lockdep_assert_console_list_lock_held(); \ hlist_for_each_entry(con, &console_list, node) @@ -9809,7 +9744,7 @@ index 6813171af..674a622c9 100644 struct kvm_vcpu; diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h -index 4a1dc88dd..a5091ac97 100644 +index 2610a7d15..72e300db1 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -609,6 +609,35 @@ extern void __raise_softirq_irqoff(unsigned int nr); @@ -9849,10 +9784,10 @@ index 4a1dc88dd..a5091ac97 100644 static inline struct task_struct *this_cpu_ksoftirqd(void) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h -index 8b5121eb8..45521298a 100644 +index 030d9de2b..1f5ae8f5a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -3258,7 +3258,11 @@ struct softnet_data { +@@ -3267,7 +3267,11 @@ struct softnet_data { int defer_count; int defer_ipi_scheduled; struct sk_buff *defer_list; @@ -9932,10 +9867,10 @@ index e4878bb58..ebebc32e7 100644 #ifdef CONFIG_SMP diff --git a/include/linux/sched.h b/include/linux/sched.h -index 2af0a8859..06d4393e2 100644 +index 955950123..178193dcc 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h -@@ -917,6 +917,9 @@ struct task_struct { +@@ -915,6 +915,9 @@ struct task_struct { * ->sched_remote_wakeup gets used, so it can be in this word. */ unsigned sched_remote_wakeup:1; @@ -9945,7 +9880,7 @@ index 2af0a8859..06d4393e2 100644 /* Bit to tell LSMs we're in execve(): */ unsigned in_execve:1; -@@ -1909,6 +1912,7 @@ static inline int dl_task_check_affinity(struct task_struct *p, const struct cpu +@@ -1907,6 +1910,7 @@ static inline int dl_task_check_affinity(struct task_struct *p, const struct cpu } #endif @@ -9953,7 +9888,7 @@ index 2af0a8859..06d4393e2 100644 extern int yield_to(struct task_struct *p, bool preempt); extern void set_user_nice(struct task_struct *p, long nice); extern int task_prio(const struct task_struct *p); -@@ -2053,17 +2057,17 @@ static inline void update_tsk_thread_flag(struct task_struct *tsk, int flag, +@@ -2051,17 +2055,17 @@ static inline void update_tsk_thread_flag(struct task_struct *tsk, int flag, update_ti_thread_flag(task_thread_info(tsk), flag, value); } @@ -9974,7 +9909,7 @@ index 2af0a8859..06d4393e2 100644 { return test_ti_thread_flag(task_thread_info(tsk), flag); } -@@ -2076,9 +2080,11 @@ static inline void set_tsk_need_resched(struct task_struct *tsk) +@@ -2074,9 +2078,11 @@ static inline void set_tsk_need_resched(struct task_struct *tsk) static inline void clear_tsk_need_resched(struct task_struct *tsk) { clear_tsk_thread_flag(tsk,TIF_NEED_RESCHED); @@ -9987,7 +9922,7 @@ index 2af0a8859..06d4393e2 100644 { return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED)); } -@@ -2259,7 +2265,7 @@ static inline int rwlock_needbreak(rwlock_t *lock) +@@ -2257,7 +2263,7 @@ static inline int rwlock_needbreak(rwlock_t *lock) static __always_inline bool need_resched(void) { @@ -10268,7 +10203,7 @@ index 9ea0b2806..5ded1450a 100644 #ifndef CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h -index aa1bc4172..689c7b0ae 100644 +index fe95d13c5..63b1a24f4 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -178,8 +178,8 @@ unsigned int tracing_gen_ctx_irq_test(unsigned int irqs_status); @@ -10541,10 +10476,10 @@ index ce2889f12..d636a1bbd 100644 * We have no kernel internal state, i.e. no waiters in the * kernel. Waiters which are about to queue themselves are stuck diff --git a/kernel/futex/requeue.c b/kernel/futex/requeue.c -index cba8b1a6a..4c73e0b81 100644 +index 7e43839ca..83cc6f7f2 100644 --- a/kernel/futex/requeue.c +++ b/kernel/futex/requeue.c -@@ -850,11 +850,13 @@ int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, +@@ -852,11 +852,13 @@ int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, pi_mutex = &q.pi_state->pi_mutex; ret = rt_mutex_wait_proxy_lock(pi_mutex, to, &rt_waiter); @@ -10591,7 +10526,7 @@ index 1d4bc493b..486c68c11 100644 NULL }; diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c -index 3468d8230..6eef8527e 100644 +index 9419a79e8..897b03afb 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -56,6 +56,7 @@ @@ -10824,7 +10759,7 @@ index d1473c624..c7196de83 100644 ww_mutex_set_context_fastpath(lock, ww_ctx); return 0; diff --git a/kernel/panic.c b/kernel/panic.c -index ef9f9a4e9..9215df21d 100644 +index d7973e975..762e2fc4d 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -366,6 +366,8 @@ void panic(const char *fmt, ...) @@ -12728,7 +12663,7 @@ index 000000000..b4278854e +} +device_initcall(printk_init_ops); diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c -index dcdf44961..80ccfbb6b 100644 +index 51c43e0f9..98495c96a 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -102,12 +102,6 @@ DEFINE_STATIC_SRCU(console_srcu); @@ -13418,7 +13353,7 @@ index dcdf44961..80ccfbb6b 100644 EXPORT_SYMBOL(console_unlock); /** -@@ -3197,6 +3318,7 @@ void console_flush_on_panic(enum con_flush_mode mode) +@@ -3207,6 +3328,7 @@ void console_flush_on_panic(enum con_flush_mode mode) if (mode == CONSOLE_REPLAY_ALL) { struct console *c; @@ -13426,7 +13361,7 @@ index dcdf44961..80ccfbb6b 100644 int cookie; u64 seq; -@@ -3204,16 +3326,25 @@ void console_flush_on_panic(enum con_flush_mode mode) +@@ -3214,16 +3336,25 @@ void console_flush_on_panic(enum con_flush_mode mode) cookie = console_srcu_read_lock(); for_each_console_srcu(c) { @@ -13458,7 +13393,7 @@ index dcdf44961..80ccfbb6b 100644 } /* -@@ -3270,13 +3401,122 @@ EXPORT_SYMBOL(console_stop); +@@ -3280,13 +3411,122 @@ EXPORT_SYMBOL(console_stop); void console_start(struct console *console) { @@ -13581,7 +13516,7 @@ index dcdf44961..80ccfbb6b 100644 static int __read_mostly keep_bootcon; static int __init keep_bootcon_setup(char *str) -@@ -3375,11 +3615,6 @@ static void try_enable_default_console(struct console *newcon) +@@ -3385,11 +3625,6 @@ static void try_enable_default_console(struct console *newcon) newcon->flags |= CON_CONSDEV; } @@ -13593,7 +13528,7 @@ index dcdf44961..80ccfbb6b 100644 static void console_init_seq(struct console *newcon, bool bootcon_registered) { struct console *con; -@@ -3428,11 +3663,20 @@ static void console_init_seq(struct console *newcon, bool bootcon_registered) +@@ -3438,11 +3673,20 @@ static void console_init_seq(struct console *newcon, bool bootcon_registered) newcon->seq = prb_next_seq(prb); for_each_console(con) { @@ -13618,7 +13553,7 @@ index dcdf44961..80ccfbb6b 100644 } } -@@ -3493,6 +3737,15 @@ void register_console(struct console *newcon) +@@ -3503,6 +3747,15 @@ void register_console(struct console *newcon) goto unlock; } @@ -13634,7 +13569,7 @@ index dcdf44961..80ccfbb6b 100644 /* * See if we want to enable this console driver by default. * -@@ -3520,8 +3773,11 @@ void register_console(struct console *newcon) +@@ -3530,8 +3783,11 @@ void register_console(struct console *newcon) err = try_enable_preferred_console(newcon, false); /* printk() messages are not printed to the Braille console. */ @@ -13647,7 +13582,7 @@ index dcdf44961..80ccfbb6b 100644 /* * If we have a bootconsole, and are switching to a real console, -@@ -3537,6 +3793,17 @@ void register_console(struct console *newcon) +@@ -3547,6 +3803,17 @@ void register_console(struct console *newcon) newcon->dropped = 0; console_init_seq(newcon, bootcon_registered); @@ -13665,7 +13600,7 @@ index dcdf44961..80ccfbb6b 100644 /* * Put this console in the list - keep the * preferred driver at the head of the list. -@@ -3589,6 +3856,11 @@ EXPORT_SYMBOL(register_console); +@@ -3599,6 +3866,11 @@ EXPORT_SYMBOL(register_console); /* Must be called under console_list_lock(). */ static int unregister_console_locked(struct console *console) { @@ -13677,7 +13612,7 @@ index dcdf44961..80ccfbb6b 100644 int res; lockdep_assert_console_list_lock_held(); -@@ -3628,11 +3900,50 @@ static int unregister_console_locked(struct console *console) +@@ -3638,11 +3910,50 @@ static int unregister_console_locked(struct console *console) */ synchronize_srcu(&console_srcu); @@ -13728,7 +13663,7 @@ index dcdf44961..80ccfbb6b 100644 return res; } -@@ -3777,69 +4088,94 @@ late_initcall(printk_late_init); +@@ -3787,69 +4098,94 @@ late_initcall(printk_late_init); /* If @con is specified, only wait for that console. Otherwise wait for all. */ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress) { @@ -13850,7 +13785,7 @@ index dcdf44961..80ccfbb6b 100644 last_diff = diff; } -@@ -3880,9 +4216,16 @@ static void wake_up_klogd_work_func(struct irq_work *irq_work) +@@ -3890,9 +4226,16 @@ static void wake_up_klogd_work_func(struct irq_work *irq_work) int pending = this_cpu_xchg(printk_pending, 0); if (pending & PRINTK_PENDING_OUTPUT) { @@ -13870,7 +13805,7 @@ index dcdf44961..80ccfbb6b 100644 } if (pending & PRINTK_PENDING_WAKEUP) -@@ -3950,11 +4293,16 @@ void defer_console_output(void) +@@ -3960,11 +4303,16 @@ void defer_console_output(void) * New messages may have been added directly to the ringbuffer * using vprintk_store(), so wake any waiters as well. */ @@ -14535,7 +14470,7 @@ index 46612fb15..f893f4cfd 100644 /* Don't allow time recalculation while creating a new task. */ diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h -index 11a1fac3a..6f085a159 100644 +index aab91040b..cfbbfc09b 100644 --- a/kernel/rcu/tree_stall.h +++ b/kernel/rcu/tree_stall.h @@ -8,6 +8,7 @@ @@ -14565,7 +14500,7 @@ index 11a1fac3a..6f085a159 100644 static void print_cpu_stall(unsigned long gps) diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index c686d826a..8024e0b05 100644 +index 1b5e4389f..4c59b8f40 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -899,14 +899,15 @@ static inline void hrtick_rq_init(struct rq *rq) @@ -14608,7 +14543,7 @@ index c686d826a..8024e0b05 100644 return true; } -@@ -1039,28 +1040,47 @@ void wake_up_q(struct wake_q_head *head) +@@ -1040,28 +1041,47 @@ void wake_up_q(struct wake_q_head *head) * might also involve a cross-CPU call to trigger the scheduler on * the target CPU. */ @@ -14664,7 +14599,7 @@ index c686d826a..8024e0b05 100644 } void resched_cpu(int cpu) -@@ -1133,7 +1153,7 @@ static void wake_up_idle_cpu(int cpu) +@@ -1134,7 +1154,7 @@ static void wake_up_idle_cpu(int cpu) if (cpu == smp_processor_id()) return; @@ -14777,7 +14712,7 @@ index c686d826a..8024e0b05 100644 static inline int __rt_effective_prio(struct task_struct *pi_task, int prio) { if (pi_task) -@@ -8886,6 +8944,21 @@ static inline void preempt_dynamic_init(void) { } +@@ -8880,6 +8938,21 @@ static inline void preempt_dynamic_init(void) { } #endif /* #ifdef CONFIG_PREEMPT_DYNAMIC */ @@ -14800,7 +14735,7 @@ index c686d826a..8024e0b05 100644 * yield - yield the current processor to other threads. * diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c -index 4c3d0d9f3..63e19b89c 100644 +index 115e266db..90028c5ba 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -333,6 +333,23 @@ static const struct file_operations sched_debug_fops = { @@ -14837,7 +14772,7 @@ index 4c3d0d9f3..63e19b89c 100644 } late_initcall(sched_init_debug); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index 726fa69c4..e12a1c66c 100644 +index 58231999d..1a0d9a1bf 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1022,8 +1022,10 @@ static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se); @@ -14905,7 +14840,7 @@ index 726fa69c4..e12a1c66c 100644 static void update_curr_fair(struct rq *rq) { update_curr(cfs_rq_of(&rq->curr->se)); -@@ -5513,7 +5529,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) +@@ -5515,7 +5531,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) /* * Update run-time statistics of the 'current'. */ @@ -14914,7 +14849,7 @@ index 726fa69c4..e12a1c66c 100644 /* * Ensure that runnable average is periodically updated. -@@ -5527,7 +5543,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) +@@ -5529,7 +5545,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) * validating it and just reschedule. */ if (queued) { @@ -14923,7 +14858,7 @@ index 726fa69c4..e12a1c66c 100644 return; } /* -@@ -5673,7 +5689,7 @@ static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec) +@@ -5675,7 +5691,7 @@ static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec) * hierarchy can be throttled */ if (!assign_cfs_rq_runtime(cfs_rq) && likely(cfs_rq->curr)) @@ -14932,7 +14867,7 @@ index 726fa69c4..e12a1c66c 100644 } static __always_inline -@@ -5933,7 +5949,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) +@@ -5935,7 +5951,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) /* Determine whether we need to wake up potentially idle CPU: */ if (rq->curr == rq->idle && rq->cfs.nr_running) @@ -14941,7 +14876,7 @@ index 726fa69c4..e12a1c66c 100644 } #ifdef CONFIG_SMP -@@ -6638,7 +6654,7 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p) +@@ -6640,7 +6656,7 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p) if (delta < 0) { if (task_current(rq, p)) @@ -14950,7 +14885,7 @@ index 726fa69c4..e12a1c66c 100644 return; } hrtick_start(rq, delta); -@@ -8316,7 +8332,7 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int +@@ -8334,7 +8350,7 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int * prevents us from potentially nominating it as a false LAST_BUDDY * below. */ @@ -14959,7 +14894,7 @@ index 726fa69c4..e12a1c66c 100644 return; if (!sched_feat(WAKEUP_PREEMPTION)) -@@ -8354,7 +8370,7 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int +@@ -8372,7 +8388,7 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int return; preempt: @@ -14968,7 +14903,7 @@ index 726fa69c4..e12a1c66c 100644 } #ifdef CONFIG_SMP -@@ -12509,7 +12525,7 @@ static inline void task_tick_core(struct rq *rq, struct task_struct *curr) +@@ -12538,7 +12554,7 @@ static inline void task_tick_core(struct rq *rq, struct task_struct *curr) */ if (rq->core->core_forceidle_count && rq->cfs.nr_running == 1 && __entity_slice_used(&curr->se, MIN_NR_TASKS_DURING_FORCEIDLE)) @@ -14977,7 +14912,7 @@ index 726fa69c4..e12a1c66c 100644 } /* -@@ -12674,7 +12690,7 @@ prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio) +@@ -12703,7 +12719,7 @@ prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio) */ if (task_current(rq, p)) { if (p->prio > oldprio) @@ -15011,7 +14946,7 @@ index 565f8374d..22d70000a 100644 raw_local_irq_disable(); diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c -index ccf1a4433..68e9b04f9 100644 +index c9a544d98..f4ac8fcc6 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -2245,8 +2245,11 @@ static int rto_next_cpu(struct root_domain *rd) @@ -15029,7 +14964,7 @@ index ccf1a4433..68e9b04f9 100644 diff --git a/kernel/sched/rt.c.orig b/kernel/sched/rt.c.orig new file mode 100644 -index 000000000..ccf1a4433 +index 000000000..c9a544d98 --- /dev/null +++ b/kernel/sched/rt.c.orig @@ -0,0 +1,3083 @@ @@ -15554,7 +15489,7 @@ index 000000000..ccf1a4433 + min_cap = uclamp_eff_value(p, UCLAMP_MIN); + max_cap = uclamp_eff_value(p, UCLAMP_MAX); + -+ cpu_cap = capacity_orig_of(cpu); ++ cpu_cap = arch_scale_cpu_capacity(cpu); + + return cpu_cap >= min(min_cap, max_cap); +} @@ -18117,10 +18052,10 @@ index 000000000..ccf1a4433 +} +#endif /* CONFIG_SCHED_DEBUG */ diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h -index d48c6a292..0bdd8f7b6 100644 +index 64634314a..ce942a435 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h -@@ -2444,6 +2444,7 @@ extern void init_sched_fair_class(void); +@@ -2443,6 +2443,7 @@ extern void init_sched_fair_class(void); extern void reweight_task(struct task_struct *p, const struct load_weight *lw); extern void resched_curr(struct rq *rq); @@ -18174,10 +18109,10 @@ index 49c8c24b4..107953e8a 100644 cgroup_leave_frozen(true); diff --git a/kernel/softirq.c b/kernel/softirq.c -index f24d80cf2..e3b9ffd7f 100644 +index d9e37f3fa..a7324be25 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c -@@ -247,6 +247,19 @@ void __local_bh_enable_ip(unsigned long ip, unsigned int cnt) +@@ -263,6 +263,19 @@ void __local_bh_enable_ip(unsigned long ip, unsigned int cnt) } EXPORT_SYMBOL(__local_bh_enable_ip); @@ -18197,7 +18132,7 @@ index f24d80cf2..e3b9ffd7f 100644 /* * Invoked from ksoftirqd_run() outside of the interrupt disabled section * to acquire the per CPU local lock for reentrancy protection. -@@ -630,6 +643,24 @@ static inline void tick_irq_exit(void) +@@ -648,6 +661,24 @@ static inline void tick_irq_exit(void) #endif } @@ -18222,7 +18157,7 @@ index f24d80cf2..e3b9ffd7f 100644 static inline void __irq_exit_rcu(void) { #ifndef __ARCH_IRQ_EXIT_IRQS_DISABLED -@@ -642,6 +673,10 @@ static inline void __irq_exit_rcu(void) +@@ -660,6 +691,10 @@ static inline void __irq_exit_rcu(void) if (!in_interrupt() && local_softirq_pending()) invoke_softirq(); @@ -18233,7 +18168,7 @@ index f24d80cf2..e3b9ffd7f 100644 tick_irq_exit(); } -@@ -974,12 +1009,70 @@ static struct smp_hotplug_thread softirq_threads = { +@@ -992,12 +1027,70 @@ static struct smp_hotplug_thread softirq_threads = { .thread_comm = "ksoftirqd/%u", }; @@ -18306,10 +18241,10 @@ index f24d80cf2..e3b9ffd7f 100644 } early_initcall(spawn_ksoftirqd); diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c -index e99b1305e..c4ce69da0 100644 +index ccea52adc..2dc017afd 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c -@@ -1812,7 +1812,7 @@ void hrtimer_interrupt(struct clock_event_device *dev) +@@ -1870,7 +1870,7 @@ void hrtimer_interrupt(struct clock_event_device *dev) if (!ktime_before(now, cpu_base->softirq_expires_next)) { cpu_base->softirq_expires_next = KTIME_MAX; cpu_base->softirq_activated = 1; @@ -18318,7 +18253,7 @@ index e99b1305e..c4ce69da0 100644 } __hrtimer_run_queues(cpu_base, now, flags, HRTIMER_ACTIVE_HARD); -@@ -1925,7 +1925,7 @@ void hrtimer_run_queues(void) +@@ -1965,7 +1965,7 @@ void hrtimer_run_queues(void) if (!ktime_before(now, cpu_base->softirq_expires_next)) { cpu_base->softirq_expires_next = KTIME_MAX; cpu_base->softirq_activated = 1; @@ -18372,10 +18307,10 @@ index 63a8ce717..b3fbe97d1 100644 /* diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index 9d9af60b2..47fa2b613 100644 +index a111be83c..9ab46a9d0 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c -@@ -2706,6 +2706,8 @@ unsigned int tracing_gen_ctx_irq_test(unsigned int irqs_status) +@@ -2709,6 +2709,8 @@ unsigned int tracing_gen_ctx_irq_test(unsigned int irqs_status) if (tif_need_resched()) trace_flags |= TRACE_FLAG_NEED_RESCHED; @@ -18385,7 +18320,7 @@ index 9d9af60b2..47fa2b613 100644 trace_flags |= TRACE_FLAG_PREEMPT_RESCHED; return (trace_flags << 16) | (min_t(unsigned int, pc & 0xff, 0xf)) | diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c -index 2b948d35f..959f09ab8 100644 +index 448ee37ae..6816eca29 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -464,17 +464,29 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) @@ -18422,16 +18357,16 @@ index 2b948d35f..959f09ab8 100644 break; diff --git a/localversion-rt b/localversion-rt new file mode 100644 -index 000000000..75493460c +index 000000000..d42c0971b --- /dev/null +++ b/localversion-rt @@ -0,0 +1 @@ -+-rt51 ++-rt66 diff --git a/net/core/dev.c b/net/core/dev.c -index 479a3892f..d33ca4a3b 100644 +index 2d3e0e413..61b4294b3 100644 --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4715,15 +4715,6 @@ static void rps_trigger_softirq(void *data) +@@ -4758,15 +4758,6 @@ static void rps_trigger_softirq(void *data) #endif /* CONFIG_RPS */ @@ -18447,7 +18382,7 @@ index 479a3892f..d33ca4a3b 100644 /* * After we queued a packet into sd->input_pkt_queue, * we need to make sure this queue is serviced soon. -@@ -6692,6 +6683,32 @@ static void skb_defer_free_flush(struct softnet_data *sd) +@@ -6735,6 +6726,32 @@ static void skb_defer_free_flush(struct softnet_data *sd) } } @@ -18480,7 +18415,7 @@ index 479a3892f..d33ca4a3b 100644 static int napi_threaded_poll(void *data) { struct napi_struct *napi = data; -@@ -11633,7 +11650,11 @@ static int __init net_dev_init(void) +@@ -11676,7 +11693,11 @@ static int __init net_dev_init(void) INIT_CSD(&sd->csd, rps_trigger_softirq, sd); sd->cpu = i; #endif @@ -18493,7 +18428,7 @@ index 479a3892f..d33ca4a3b 100644 init_gro_hash(&sd->backlog); diff --git a/net/core/skbuff.c b/net/core/skbuff.c -index f0a9ef1ae..682175af4 100644 +index 867832f8b..4413f9367 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -6863,8 +6863,13 @@ nodefer: __kfree_skb(skb); diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0011-v6.6-stm32mp-rt-r2.patch b/meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0011-v6.6-stm32mp-rt-r2.patch deleted file mode 100644 index 84f8923a8..000000000 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0011-v6.6-stm32mp-rt-r2.patch +++ /dev/null @@ -1,515 +0,0 @@ -From 57e65e96ba3f5350f7ec305a8ea4318b2c6d88b9 Mon Sep 17 00:00:00 2001 -From: Christophe Priouzeau -Date: Thu, 5 Jun 2025 11:10:31 +0200 -Subject: [PATCH] v6.6-stm32mp-rt-r2 - ---- -Upstream-Status: Pending [specific to ST boards] - - .../configs/fragment-07-rt-sysvinit.config | 12 ++++ - arch/arm/configs/fragment-07-rt.config | 9 +++ - arch/arm/configs/fragment-10-rt-perf.config | 40 +++++++++++++ - .../configs/fragment-07-rt-sysvinit.config | 12 ++++ - arch/arm64/configs/fragment-07-rt.config | 9 +++ - arch/arm64/configs/fragment-10-rt-perf.config | 40 +++++++++++++ - drivers/clocksource/timer-stm32-lp.c | 36 +++++++++++- - drivers/hwtracing/coresight/coresight-cti.h | 10 ++++ - drivers/input/keyboard/gpio_keys.c | 7 ++- - drivers/mfd/syscon.c | 3 + - drivers/tty/serial/stm32-usart.c | 56 +++++-------------- - 11 files changed, 188 insertions(+), 46 deletions(-) - create mode 100644 arch/arm/configs/fragment-07-rt-sysvinit.config - create mode 100644 arch/arm/configs/fragment-07-rt.config - create mode 100644 arch/arm/configs/fragment-10-rt-perf.config - create mode 100644 arch/arm64/configs/fragment-07-rt-sysvinit.config - create mode 100644 arch/arm64/configs/fragment-07-rt.config - create mode 100644 arch/arm64/configs/fragment-10-rt-perf.config - -diff --git a/arch/arm/configs/fragment-07-rt-sysvinit.config b/arch/arm/configs/fragment-07-rt-sysvinit.config -new file mode 100644 -index 000000000..49a4baf60 ---- /dev/null -+++ b/arch/arm/configs/fragment-07-rt-sysvinit.config -@@ -0,0 +1,12 @@ -+CONFIG_CGROUPS=y -+# CONFIG_CGROUP_SCHED is not set -+# CONFIG_CGROUP_PIDS is not set -+# CONFIG_CGROUP_RDMA is not set -+# CONFIG_CGROUP_FREEZER is not set -+# CONFIG_CGROUP_DEVICE is not set -+# CONFIG_CGROUP_CPUACCT is not set -+# CONFIG_CGROUP_PERF is not set -+# CONFIG_CGROUP_DEBUG is not set -+# CONFIG_CGROUP_NET_PRIO is not set -+# CONFIG_CGROUP_NET_CLASSID is not set -+ -diff --git a/arch/arm/configs/fragment-07-rt.config b/arch/arm/configs/fragment-07-rt.config -new file mode 100644 -index 000000000..aba9d8c25 ---- /dev/null -+++ b/arch/arm/configs/fragment-07-rt.config -@@ -0,0 +1,9 @@ -+CONFIG_EXPERT=y -+CONFIG_PREEMPT_RT=y -+ -+# Force to have HIGH_RES_TIMERS -+CONFIG_HIGH_RES_TIMERS=y -+ -+# Disable CPUFREQ and CPUIDLE -+# CONFIG_CPU_FREQ is not set -+# CONFIG_CPU_IDLE is not set -diff --git a/arch/arm/configs/fragment-10-rt-perf.config b/arch/arm/configs/fragment-10-rt-perf.config -new file mode 100644 -index 000000000..46e67dba9 ---- /dev/null -+++ b/arch/arm/configs/fragment-10-rt-perf.config -@@ -0,0 +1,40 @@ -+# avoid degrading from-idle transition latencies, disable dyntick -+CONFIG_HZ_PERIODIC=y -+ -+# Disable OPTEE RNG over PTA support -+# CONFIG_HW_RANDOM_OPTEE is not set -+ -+# Remove power domains management -+# CONFIG_SUSPEND_FREEZER is not set -+# CONFIG_HIBERNATE_CALLBACKS is not set -+# CONFIG_PM_SLEEP is not set -+# CONFIG_PM_TRACE_RTC is not set -+# CONFIG_PM_GENERIC_DOMAINS is not set -+ -+#Debugging features -+CONFIG_DEBUG_KERNEL=y -+# CONFIG_PROFILING is not set -+# CONFIG_PSI is not set -+# to Enable ftrace, you need to enable the following configuration: -+# CONFIG_TRACING is not set -+# CONFIG_FTRACE is not set -+# CONFIG_IRQSOFF_TRACER is not set -+# CONFIG_PREEMPT_TRACER is not set -+# CONFIG_SCHED_TRACER is not set -+# CONFIG_FUNCTION_TRACER is not set -+# CONFIG_FTRACE_SYSCALLS is not set -+# CONFIG_STACK_TRACER is not set -+# CONFIG_FUNCTION_PROFILER is not set -+# CONFIG_TIMERLAT_TRACER is not set -+ -+#Lockdep activation -+# CONFIG_DEBUG_ATOMIC_SLEEP is not set -+# CONFIG_DEBUG_LOCK_ALLOC is not set -+# CONFIG_DEBUG_MUTEXES is not set -+# CONFIG_DEBUG_SPINLOCK is not set -+# CONFIG_LOCKDEP is not set -+# CONFIG_LOCKUP_DETECTOR is not set -+# CONFIG_PROVE_LOCKING is not set -+# CONFIG_SLUB_DEBUG_ON is not set -+ -+# CONFIG_ARM_SMC_WATCHDOG is not set -diff --git a/arch/arm64/configs/fragment-07-rt-sysvinit.config b/arch/arm64/configs/fragment-07-rt-sysvinit.config -new file mode 100644 -index 000000000..49a4baf60 ---- /dev/null -+++ b/arch/arm64/configs/fragment-07-rt-sysvinit.config -@@ -0,0 +1,12 @@ -+CONFIG_CGROUPS=y -+# CONFIG_CGROUP_SCHED is not set -+# CONFIG_CGROUP_PIDS is not set -+# CONFIG_CGROUP_RDMA is not set -+# CONFIG_CGROUP_FREEZER is not set -+# CONFIG_CGROUP_DEVICE is not set -+# CONFIG_CGROUP_CPUACCT is not set -+# CONFIG_CGROUP_PERF is not set -+# CONFIG_CGROUP_DEBUG is not set -+# CONFIG_CGROUP_NET_PRIO is not set -+# CONFIG_CGROUP_NET_CLASSID is not set -+ -diff --git a/arch/arm64/configs/fragment-07-rt.config b/arch/arm64/configs/fragment-07-rt.config -new file mode 100644 -index 000000000..aba9d8c25 ---- /dev/null -+++ b/arch/arm64/configs/fragment-07-rt.config -@@ -0,0 +1,9 @@ -+CONFIG_EXPERT=y -+CONFIG_PREEMPT_RT=y -+ -+# Force to have HIGH_RES_TIMERS -+CONFIG_HIGH_RES_TIMERS=y -+ -+# Disable CPUFREQ and CPUIDLE -+# CONFIG_CPU_FREQ is not set -+# CONFIG_CPU_IDLE is not set -diff --git a/arch/arm64/configs/fragment-10-rt-perf.config b/arch/arm64/configs/fragment-10-rt-perf.config -new file mode 100644 -index 000000000..46e67dba9 ---- /dev/null -+++ b/arch/arm64/configs/fragment-10-rt-perf.config -@@ -0,0 +1,40 @@ -+# avoid degrading from-idle transition latencies, disable dyntick -+CONFIG_HZ_PERIODIC=y -+ -+# Disable OPTEE RNG over PTA support -+# CONFIG_HW_RANDOM_OPTEE is not set -+ -+# Remove power domains management -+# CONFIG_SUSPEND_FREEZER is not set -+# CONFIG_HIBERNATE_CALLBACKS is not set -+# CONFIG_PM_SLEEP is not set -+# CONFIG_PM_TRACE_RTC is not set -+# CONFIG_PM_GENERIC_DOMAINS is not set -+ -+#Debugging features -+CONFIG_DEBUG_KERNEL=y -+# CONFIG_PROFILING is not set -+# CONFIG_PSI is not set -+# to Enable ftrace, you need to enable the following configuration: -+# CONFIG_TRACING is not set -+# CONFIG_FTRACE is not set -+# CONFIG_IRQSOFF_TRACER is not set -+# CONFIG_PREEMPT_TRACER is not set -+# CONFIG_SCHED_TRACER is not set -+# CONFIG_FUNCTION_TRACER is not set -+# CONFIG_FTRACE_SYSCALLS is not set -+# CONFIG_STACK_TRACER is not set -+# CONFIG_FUNCTION_PROFILER is not set -+# CONFIG_TIMERLAT_TRACER is not set -+ -+#Lockdep activation -+# CONFIG_DEBUG_ATOMIC_SLEEP is not set -+# CONFIG_DEBUG_LOCK_ALLOC is not set -+# CONFIG_DEBUG_MUTEXES is not set -+# CONFIG_DEBUG_SPINLOCK is not set -+# CONFIG_LOCKDEP is not set -+# CONFIG_LOCKUP_DETECTOR is not set -+# CONFIG_PROVE_LOCKING is not set -+# CONFIG_SLUB_DEBUG_ON is not set -+ -+# CONFIG_ARM_SMC_WATCHDOG is not set -diff --git a/drivers/clocksource/timer-stm32-lp.c b/drivers/clocksource/timer-stm32-lp.c -index 815abee7c..4191d38c3 100644 ---- a/drivers/clocksource/timer-stm32-lp.c -+++ b/drivers/clocksource/timer-stm32-lp.c -@@ -43,7 +43,8 @@ static int stm32_clkevent_lp_shutdown(struct clock_event_device *clkevt) - struct stm32_lp_private *priv = to_priv(clkevt); - int ret; - -- if (clockevent_state_oneshot(clkevt) || clockevent_state_periodic(clkevt)) { -+ if (!IS_ENABLED(CONFIG_PREEMPT_RT) && -+ (clockevent_state_oneshot(clkevt) || clockevent_state_periodic(clkevt))) { - ret = pm_runtime_put(priv->dev); - if (ret < 0) { - dev_err(priv->dev, "pm runtime get returned %d\n", ret); -@@ -147,6 +148,13 @@ static int stm32_clkevent_lp_pm_runtime_get(struct clock_event_device *clkevt) - struct stm32_lp_private *priv = to_priv(clkevt); - int ret; - -+ /* -+ * When in PREEMPT_RT, pm_runtime acquires a spinlock, that's not allowed in -+ * atomic context. Workaround it by enabling runtime PM upon probe. -+ */ -+ if (IS_ENABLED(CONFIG_PREEMPT_RT)) -+ return 0; -+ - /* Rely on old clockevent state, to balance pm_runtime_get() / pm_runtime_put() calls */ - if (clockevent_state_detached(clkevt) || clockevent_state_shutdown(clkevt)) { - ret = pm_runtime_get(priv->dev); -@@ -160,6 +168,17 @@ static int stm32_clkevent_lp_pm_runtime_get(struct clock_event_device *clkevt) - return 0; - } - -+static void stm32_clkevent_lp_pm_runtime_err(struct clock_event_device *clkevt) -+{ -+ struct stm32_lp_private *priv = to_priv(clkevt); -+ -+ if (IS_ENABLED(CONFIG_PREEMPT_RT)) -+ return; -+ -+ if (clockevent_state_detached(clkevt) || clockevent_state_shutdown(clkevt)) -+ pm_runtime_put(priv->dev); -+} -+ - static int stm32_clkevent_lp_set_periodic(struct clock_event_device *clkevt) - { - struct stm32_lp_private *priv = to_priv(clkevt); -@@ -171,7 +190,7 @@ static int stm32_clkevent_lp_set_periodic(struct clock_event_device *clkevt) - - ret = stm32_clkevent_lp_set_timer(priv->period, clkevt, true); - if (ret < 0) -- pm_runtime_put(priv->dev); -+ stm32_clkevent_lp_pm_runtime_err(clkevt); - - return ret; - } -@@ -187,7 +206,7 @@ static int stm32_clkevent_lp_set_oneshot(struct clock_event_device *clkevt) - - ret = stm32_clkevent_lp_set_timer(priv->period, clkevt, false); - if (ret < 0) -- pm_runtime_put(priv->dev); -+ stm32_clkevent_lp_pm_runtime_err(clkevt); - - return ret; - } -@@ -311,6 +330,17 @@ static int stm32_clkevent_lp_probe(struct platform_device *pdev) - if (ret) - return ret; - -+ /* -+ * When in PREEMPT_RT, pm_runtime acquires a spinlock, that's not allowed in atomic -+ * context. Runtime PM is used to acquire the parent's PM domain, when there's one. -+ * That's not necessarily the case on all instances, so it seems an acceptable trade-off. -+ */ -+ if (IS_ENABLED(CONFIG_PREEMPT_RT)) { -+ ret = pm_runtime_resume_and_get(&pdev->dev); -+ if (ret) -+ return ret; -+ } -+ - priv->dev = &pdev->dev; - - stm32_clkevent_lp_init(priv, pdev->dev.parent->of_node, rate); -diff --git a/drivers/hwtracing/coresight/coresight-cti.h b/drivers/hwtracing/coresight/coresight-cti.h -index cb9ee616d..9f9eaaf29 100644 ---- a/drivers/hwtracing/coresight/coresight-cti.h -+++ b/drivers/hwtracing/coresight/coresight-cti.h -@@ -17,6 +17,16 @@ - - #include "coresight-priv.h" - -+#ifdef CONFIG_PREEMPT_RT -+#undef spin_lock_init -+#define spin_lock_init raw_spin_lock_init -+#define spin_lock raw_spin_lock -+#define spin_unlock raw_spin_unlock -+#undef spin_lock_irqsave -+#define spin_lock_irqsave raw_spin_lock_irqsave -+#define spin_unlock_irqrestore raw_spin_unlock_irqrestore -+#define spinlock_t raw_spinlock_t -+#endif - /* - * Device registers - * 0x000 - 0x144: CTI programming and status -diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c -index 2e7c2c046..b96a85460 100644 ---- a/drivers/input/keyboard/gpio_keys.c -+++ b/drivers/input/keyboard/gpio_keys.c -@@ -454,12 +454,15 @@ static enum hrtimer_restart gpio_keys_irq_timer(struct hrtimer *t) - struct gpio_button_data, - release_timer); - struct input_dev *input = bdata->input; -+ unsigned long flags; - -+ spin_lock_irqsave(&bdata->lock, flags); - if (bdata->key_pressed) { - input_report_key(input, *bdata->code, 0); - input_sync(input); - bdata->key_pressed = false; - } -+ spin_unlock_irqrestore(&bdata->lock, flags); - - return HRTIMER_NORESTART; - } -@@ -493,7 +496,7 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id) - if (bdata->release_delay) - hrtimer_start(&bdata->release_timer, - ms_to_ktime(bdata->release_delay), -- HRTIMER_MODE_REL_HARD); -+ HRTIMER_MODE_REL); - out: - spin_unlock_irqrestore(&bdata->lock, flags); - return IRQ_HANDLED; -@@ -630,7 +633,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev, - - bdata->release_delay = button->debounce_interval; - hrtimer_init(&bdata->release_timer, -- CLOCK_REALTIME, HRTIMER_MODE_REL_HARD); -+ CLOCK_REALTIME, HRTIMER_MODE_REL); - bdata->release_timer.function = gpio_keys_irq_timer; - - isr = gpio_keys_irq_isr; -diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c -index 729e79e1b..233712c70 100644 ---- a/drivers/mfd/syscon.c -+++ b/drivers/mfd/syscon.c -@@ -42,6 +42,9 @@ static const struct regmap_config syscon_regmap_config = { - .reg_bits = 32, - .val_bits = 32, - .reg_stride = 4, -+#ifdef CONFIG_PREEMPT_RT -+ .use_raw_spinlock = true, -+#endif - }; - - static struct syscon *of_syscon_register(struct device_node *np, bool check_res) -diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c -index 1c949774f..b56d3b77c 100644 ---- a/drivers/tty/serial/stm32-usart.c -+++ b/drivers/tty/serial/stm32-usart.c -@@ -58,7 +58,6 @@ static struct stm32_usart_info __maybe_unused stm32f4_info = { - .cfg = { - .uart_enable_bit = 13, - .has_7bits_data = false, -- .fifosize = 1, - } - }; - -@@ -82,7 +81,6 @@ static struct stm32_usart_info __maybe_unused stm32f7_info = { - .uart_enable_bit = 0, - .has_7bits_data = true, - .has_swap = true, -- .fifosize = 1, - } - }; - -@@ -109,7 +107,6 @@ static struct stm32_usart_info __maybe_unused stm32h7_info = { - .has_swap = true, - .has_wakeup = true, - .has_fifo = true, -- .fifosize = 16, - } - }; - -@@ -192,7 +189,6 @@ static void stm32_usart_config_reg_rs485(u32 *cr1, u32 *cr3, u32 delay_ADE, - u32 delay_DDE, u32 baud) - { - u32 rs485_deat_dedt; -- u32 rs485_deat_dedt_max = (USART_CR1_DEAT_MASK >> USART_CR1_DEAT_SHIFT); - bool over8; - - *cr3 |= USART_CR3_DEM; -@@ -205,24 +201,18 @@ static void stm32_usart_config_reg_rs485(u32 *cr1, u32 *cr3, u32 delay_ADE, - else - rs485_deat_dedt = delay_ADE * baud * 16; - -- rs485_deat_dedt = DIV_ROUND_CLOSEST(rs485_deat_dedt, 1000); -- rs485_deat_dedt = rs485_deat_dedt > rs485_deat_dedt_max ? -- rs485_deat_dedt_max : rs485_deat_dedt; -- rs485_deat_dedt = (rs485_deat_dedt << USART_CR1_DEAT_SHIFT) & -- USART_CR1_DEAT_MASK; -- *cr1 |= rs485_deat_dedt; -+ rs485_deat_dedt = DIV_ROUND_UP(rs485_deat_dedt, 1000); -+ rs485_deat_dedt = min_t(u32, rs485_deat_dedt, FIELD_MAX(USART_CR1_DEAT_MASK)); -+ *cr1 |= FIELD_PREP(USART_CR1_DEAT_MASK, rs485_deat_dedt); - - if (over8) - rs485_deat_dedt = delay_DDE * baud * 8; - else - rs485_deat_dedt = delay_DDE * baud * 16; - -- rs485_deat_dedt = DIV_ROUND_CLOSEST(rs485_deat_dedt, 1000); -- rs485_deat_dedt = rs485_deat_dedt > rs485_deat_dedt_max ? -- rs485_deat_dedt_max : rs485_deat_dedt; -- rs485_deat_dedt = (rs485_deat_dedt << USART_CR1_DEDT_SHIFT) & -- USART_CR1_DEDT_MASK; -- *cr1 |= rs485_deat_dedt; -+ rs485_deat_dedt = DIV_ROUND_UP(rs485_deat_dedt, 1000); -+ rs485_deat_dedt = min_t(u32, rs485_deat_dedt, FIELD_MAX(USART_CR1_DEDT_MASK)); -+ *cr1 |= FIELD_PREP(USART_CR1_DEDT_MASK, rs485_deat_dedt); - } - - static int stm32_usart_config_rs485(struct uart_port *port, struct ktermios *termios, -@@ -850,9 +840,9 @@ static void stm32_usart_tx_dma_complete(void *arg) - pm_runtime_get(port->dev); - - /* Let's see if we have pending data to send */ -- spin_lock_irqsave(&port->lock, flags); -+ uart_port_lock_irqsave(port, &flags); - stm32_usart_transmit_chars(port); -- spin_unlock_irqrestore(&port->lock, flags); -+ uart_port_unlock_irqrestore(port, flags); - - pm_runtime_mark_last_busy(port->dev); - pm_runtime_put_autosuspend(port->dev); -@@ -1142,7 +1132,7 @@ static irqreturn_t stm32_usart_interrupt(int irq, void *ptr) - if (!stm32_port->throttled) { - if (((sr & USART_SR_RXNE) && !stm32_usart_rx_dma_started(stm32_port)) || - ((sr & USART_SR_ERR_MASK) && stm32_usart_rx_dma_started(stm32_port))) { -- spin_lock(&port->lock); -+ uart_port_lock(port); - size = stm32_usart_receive_chars(port, false); - uart_unlock_and_check_sysrq(port); - if (size) -@@ -1153,15 +1143,15 @@ static irqreturn_t stm32_usart_interrupt(int irq, void *ptr) - } - - if ((sr & USART_SR_TXE) && !(stm32_port->tx_ch)) { -- spin_lock(&port->lock); -+ uart_port_lock(port); - stm32_usart_transmit_chars(port); -- spin_unlock(&port->lock); -+ uart_port_unlock(port); - ret = IRQ_HANDLED; - } - - /* Receiver timeout irq for DMA RX */ - if (stm32_usart_rx_dma_started(stm32_port) && !stm32_port->throttled) { -- spin_lock(&port->lock); -+ uart_port_lock(port); - size = stm32_usart_receive_chars(port, false); - uart_unlock_and_check_sysrq(port); - if (size) -@@ -1319,7 +1309,7 @@ static void stm32_usart_unthrottle(struct uart_port *port) - if (stm32_port->rx_ch) - stm32_usart_rx_dma_start_or_resume(port); - -- spin_unlock_irqrestore(&port->lock, flags); -+ uart_port_unlock_irqrestore(port, flags); - - /* Port is unthrottled, balance pm_runtime */ - pm_runtime_mark_last_busy(port->dev); -@@ -1345,7 +1335,6 @@ static void stm32_usart_stop_rx(struct uart_port *port) - pm_runtime_put_autosuspend(port->dev); - } - --/* Handle breaks - ignored by us */ - static void stm32_usart_break_ctl(struct uart_port *port, int break_state) - { - struct stm32_port *stm32_port = to_stm32_port(port); -@@ -1701,12 +1690,6 @@ static void stm32_usart_set_termios(struct uart_port *port, - cr1 &= ~(USART_CR1_DEDT_MASK | USART_CR1_DEAT_MASK); - } - -- /* Configure wake up from low power on start bit detection */ -- if (stm32_port->wakeup_src) { -- cr3 &= ~USART_CR3_WUS_MASK; -- cr3 |= USART_CR3_WUS_START_BIT; -- } -- - writel_relaxed(cr3, port->membase + ofs->cr3); - writel_relaxed(cr2, port->membase + ofs->cr2); - writel_relaxed(cr1, port->membase + ofs->cr1); -@@ -1765,9 +1748,9 @@ static void stm32_usart_pm(struct uart_port *port, unsigned int state, - clk_prepare_enable(stm32port->clk); - break; - case UART_PM_STATE_OFF: -- spin_lock_irqsave(&port->lock, flags); -+ uart_port_lock_irqsave(port, &flags); - stm32_usart_clr_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit)); -- spin_unlock_irqrestore(&port->lock, flags); -+ uart_port_unlock_irqrestore(port, flags); - - clk_disable_unprepare(stm32port->clk); - break; -@@ -1910,7 +1893,6 @@ static int stm32_usart_init_port(struct stm32_port *stm32port, - port->flags = UPF_BOOT_AUTOCONF; - port->ops = &stm32_uart_ops; - port->dev = &pdev->dev; -- port->fifosize = stm32port->info->cfg.fifosize; - port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_STM32_CONSOLE); - port->irq = irq; - port->rs485_config = stm32_usart_config_rs485; -@@ -1928,14 +1910,6 @@ static int stm32_usart_init_port(struct stm32_port *stm32port, - stm32port->swap = stm32port->info->cfg.has_swap && - of_property_read_bool(pdev->dev.of_node, "rx-tx-swap"); - -- stm32port->fifoen = stm32port->info->cfg.has_fifo; -- if (stm32port->fifoen) { -- stm32_usart_get_ftcfg(pdev, "rx-threshold", -- &stm32port->rxftcfg); -- stm32_usart_get_ftcfg(pdev, "tx-threshold", -- &stm32port->txftcfg); -- } -- - port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(port->membase)) - return PTR_ERR(port->membase); --- -2.43.0 - diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0011-v6.6-stm32mp-rt-r3.patch b/meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0011-v6.6-stm32mp-rt-r3.patch new file mode 100644 index 000000000..7b6aa2bbe --- /dev/null +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey/stm32mpcommon/0011-v6.6-stm32mp-rt-r3.patch @@ -0,0 +1,321 @@ +From: Mike Engel +Date: Tue, 12 May 2026 13:15:38 +0200 +Subject: [PATCH 2/2] v6.6-stm32mp-rt-r3 + +Patch doesn't apply cleanly on our kernel due to changes in +the serial driver. +Original patch: +From f6587496f2c5894abf9bcfbd136a9693d0e97f11 Mon Sep 17 00:00:00 2001 +From: Christophe Priouzeau +Date: Tue, 16 Dec 2025 13:49:21 +0100 + +Signed-off-by: Mike Engel + +Upstream-Status: Pending [specific to ST boards] +--- + .../configs/fragment-07-rt-sysvinit.config | 11 +++++ + arch/arm/configs/fragment-07-rt.config | 9 +++++ + arch/arm/configs/fragment-10-rt-perf.config | 40 +++++++++++++++++++ + .../configs/fragment-07-rt-sysvinit.config | 11 +++++ + arch/arm64/configs/fragment-07-rt.config | 9 +++++ + arch/arm64/configs/fragment-10-rt-perf.config | 40 +++++++++++++++++++ + drivers/clocksource/timer-stm32-lp.c | 24 ++++++++++- + drivers/hwtracing/coresight/coresight-cti.h | 10 +++++ + drivers/mfd/syscon.c | 3 ++ + drivers/tty/serial/stm32-usart.c | 8 ++-- + 10 files changed, 160 insertions(+), 5 deletions(-) + create mode 100644 arch/arm/configs/fragment-07-rt-sysvinit.config + create mode 100644 arch/arm/configs/fragment-07-rt.config + create mode 100644 arch/arm/configs/fragment-10-rt-perf.config + create mode 100644 arch/arm64/configs/fragment-07-rt-sysvinit.config + create mode 100644 arch/arm64/configs/fragment-07-rt.config + create mode 100644 arch/arm64/configs/fragment-10-rt-perf.config + +diff --git a/arch/arm/configs/fragment-07-rt-sysvinit.config b/arch/arm/configs/fragment-07-rt-sysvinit.config +new file mode 100644 +index 000000000000..4a858d74d97d +--- /dev/null ++++ b/arch/arm/configs/fragment-07-rt-sysvinit.config +@@ -0,0 +1,11 @@ ++CONFIG_CGROUPS=y ++# CONFIG_CGROUP_SCHED is not set ++# CONFIG_CGROUP_PIDS is not set ++# CONFIG_CGROUP_RDMA is not set ++# CONFIG_CGROUP_FREEZER is not set ++# CONFIG_CGROUP_DEVICE is not set ++# CONFIG_CGROUP_CPUACCT is not set ++# CONFIG_CGROUP_PERF is not set ++# CONFIG_CGROUP_DEBUG is not set ++# CONFIG_CGROUP_NET_PRIO is not set ++# CONFIG_CGROUP_NET_CLASSID is not set +diff --git a/arch/arm/configs/fragment-07-rt.config b/arch/arm/configs/fragment-07-rt.config +new file mode 100644 +index 000000000000..aba9d8c25610 +--- /dev/null ++++ b/arch/arm/configs/fragment-07-rt.config +@@ -0,0 +1,9 @@ ++CONFIG_EXPERT=y ++CONFIG_PREEMPT_RT=y ++ ++# Force to have HIGH_RES_TIMERS ++CONFIG_HIGH_RES_TIMERS=y ++ ++# Disable CPUFREQ and CPUIDLE ++# CONFIG_CPU_FREQ is not set ++# CONFIG_CPU_IDLE is not set +diff --git a/arch/arm/configs/fragment-10-rt-perf.config b/arch/arm/configs/fragment-10-rt-perf.config +new file mode 100644 +index 000000000000..46e67dba9ef8 +--- /dev/null ++++ b/arch/arm/configs/fragment-10-rt-perf.config +@@ -0,0 +1,40 @@ ++# avoid degrading from-idle transition latencies, disable dyntick ++CONFIG_HZ_PERIODIC=y ++ ++# Disable OPTEE RNG over PTA support ++# CONFIG_HW_RANDOM_OPTEE is not set ++ ++# Remove power domains management ++# CONFIG_SUSPEND_FREEZER is not set ++# CONFIG_HIBERNATE_CALLBACKS is not set ++# CONFIG_PM_SLEEP is not set ++# CONFIG_PM_TRACE_RTC is not set ++# CONFIG_PM_GENERIC_DOMAINS is not set ++ ++#Debugging features ++CONFIG_DEBUG_KERNEL=y ++# CONFIG_PROFILING is not set ++# CONFIG_PSI is not set ++# to Enable ftrace, you need to enable the following configuration: ++# CONFIG_TRACING is not set ++# CONFIG_FTRACE is not set ++# CONFIG_IRQSOFF_TRACER is not set ++# CONFIG_PREEMPT_TRACER is not set ++# CONFIG_SCHED_TRACER is not set ++# CONFIG_FUNCTION_TRACER is not set ++# CONFIG_FTRACE_SYSCALLS is not set ++# CONFIG_STACK_TRACER is not set ++# CONFIG_FUNCTION_PROFILER is not set ++# CONFIG_TIMERLAT_TRACER is not set ++ ++#Lockdep activation ++# CONFIG_DEBUG_ATOMIC_SLEEP is not set ++# CONFIG_DEBUG_LOCK_ALLOC is not set ++# CONFIG_DEBUG_MUTEXES is not set ++# CONFIG_DEBUG_SPINLOCK is not set ++# CONFIG_LOCKDEP is not set ++# CONFIG_LOCKUP_DETECTOR is not set ++# CONFIG_PROVE_LOCKING is not set ++# CONFIG_SLUB_DEBUG_ON is not set ++ ++# CONFIG_ARM_SMC_WATCHDOG is not set +diff --git a/arch/arm64/configs/fragment-07-rt-sysvinit.config b/arch/arm64/configs/fragment-07-rt-sysvinit.config +new file mode 100644 +index 000000000000..4a858d74d97d +--- /dev/null ++++ b/arch/arm64/configs/fragment-07-rt-sysvinit.config +@@ -0,0 +1,11 @@ ++CONFIG_CGROUPS=y ++# CONFIG_CGROUP_SCHED is not set ++# CONFIG_CGROUP_PIDS is not set ++# CONFIG_CGROUP_RDMA is not set ++# CONFIG_CGROUP_FREEZER is not set ++# CONFIG_CGROUP_DEVICE is not set ++# CONFIG_CGROUP_CPUACCT is not set ++# CONFIG_CGROUP_PERF is not set ++# CONFIG_CGROUP_DEBUG is not set ++# CONFIG_CGROUP_NET_PRIO is not set ++# CONFIG_CGROUP_NET_CLASSID is not set +diff --git a/arch/arm64/configs/fragment-07-rt.config b/arch/arm64/configs/fragment-07-rt.config +new file mode 100644 +index 000000000000..aba9d8c25610 +--- /dev/null ++++ b/arch/arm64/configs/fragment-07-rt.config +@@ -0,0 +1,9 @@ ++CONFIG_EXPERT=y ++CONFIG_PREEMPT_RT=y ++ ++# Force to have HIGH_RES_TIMERS ++CONFIG_HIGH_RES_TIMERS=y ++ ++# Disable CPUFREQ and CPUIDLE ++# CONFIG_CPU_FREQ is not set ++# CONFIG_CPU_IDLE is not set +diff --git a/arch/arm64/configs/fragment-10-rt-perf.config b/arch/arm64/configs/fragment-10-rt-perf.config +new file mode 100644 +index 000000000000..46e67dba9ef8 +--- /dev/null ++++ b/arch/arm64/configs/fragment-10-rt-perf.config +@@ -0,0 +1,40 @@ ++# avoid degrading from-idle transition latencies, disable dyntick ++CONFIG_HZ_PERIODIC=y ++ ++# Disable OPTEE RNG over PTA support ++# CONFIG_HW_RANDOM_OPTEE is not set ++ ++# Remove power domains management ++# CONFIG_SUSPEND_FREEZER is not set ++# CONFIG_HIBERNATE_CALLBACKS is not set ++# CONFIG_PM_SLEEP is not set ++# CONFIG_PM_TRACE_RTC is not set ++# CONFIG_PM_GENERIC_DOMAINS is not set ++ ++#Debugging features ++CONFIG_DEBUG_KERNEL=y ++# CONFIG_PROFILING is not set ++# CONFIG_PSI is not set ++# to Enable ftrace, you need to enable the following configuration: ++# CONFIG_TRACING is not set ++# CONFIG_FTRACE is not set ++# CONFIG_IRQSOFF_TRACER is not set ++# CONFIG_PREEMPT_TRACER is not set ++# CONFIG_SCHED_TRACER is not set ++# CONFIG_FUNCTION_TRACER is not set ++# CONFIG_FTRACE_SYSCALLS is not set ++# CONFIG_STACK_TRACER is not set ++# CONFIG_FUNCTION_PROFILER is not set ++# CONFIG_TIMERLAT_TRACER is not set ++ ++#Lockdep activation ++# CONFIG_DEBUG_ATOMIC_SLEEP is not set ++# CONFIG_DEBUG_LOCK_ALLOC is not set ++# CONFIG_DEBUG_MUTEXES is not set ++# CONFIG_DEBUG_SPINLOCK is not set ++# CONFIG_LOCKDEP is not set ++# CONFIG_LOCKUP_DETECTOR is not set ++# CONFIG_PROVE_LOCKING is not set ++# CONFIG_SLUB_DEBUG_ON is not set ++ ++# CONFIG_ARM_SMC_WATCHDOG is not set +diff --git a/drivers/clocksource/timer-stm32-lp.c b/drivers/clocksource/timer-stm32-lp.c +index dedf59187352..4feb2b79b5eb 100644 +--- a/drivers/clocksource/timer-stm32-lp.c ++++ b/drivers/clocksource/timer-stm32-lp.c +@@ -45,7 +45,8 @@ static int stm32_clkevent_lp_shutdown(struct clock_event_device *clkevt) + int loop_limit = 500; + u32 val; + +- if (clockevent_state_oneshot(clkevt) || clockevent_state_periodic(clkevt)) { ++ if (!IS_ENABLED(CONFIG_PREEMPT_RT) && ++ (clockevent_state_oneshot(clkevt) || clockevent_state_periodic(clkevt))) { + ret = pm_runtime_put(priv->dev); + if (ret < 0) { + dev_err(priv->dev, "pm runtime get returned %d\n", ret); +@@ -179,6 +180,13 @@ static int stm32_clkevent_lp_pm_runtime_get(struct clock_event_device *clkevt) + struct stm32_lp_private *priv = to_priv(clkevt); + int ret; + ++ /* ++ * When in PREEMPT_RT, pm_runtime acquires a spinlock, that's not allowed in ++ * atomic context. Workaround it by enabling runtime PM upon probe. ++ */ ++ if (IS_ENABLED(CONFIG_PREEMPT_RT)) ++ return 0; ++ + /* Rely on old clockevent state, to balance pm_runtime_get() / pm_runtime_put() calls */ + if (clockevent_state_detached(clkevt) || clockevent_state_shutdown(clkevt)) { + ret = pm_runtime_get(priv->dev); +@@ -196,6 +204,9 @@ static void stm32_clkevent_lp_pm_runtime_err(struct clock_event_device *clkevt) + { + struct stm32_lp_private *priv = to_priv(clkevt); + ++ if (IS_ENABLED(CONFIG_PREEMPT_RT)) ++ return; ++ + if (clockevent_state_detached(clkevt) || clockevent_state_shutdown(clkevt)) + pm_runtime_put(priv->dev); + } +@@ -351,6 +362,17 @@ static int stm32_clkevent_lp_probe(struct platform_device *pdev) + if (ret) + return ret; + ++ /* ++ * When in PREEMPT_RT, pm_runtime acquires a spinlock, that's not allowed in atomic ++ * context. Runtime PM is used to acquire the parent's PM domain, when there's one. ++ * That's not necessarily the case on all instances, so it seems an acceptable trade-off. ++ */ ++ if (IS_ENABLED(CONFIG_PREEMPT_RT)) { ++ ret = pm_runtime_resume_and_get(&pdev->dev); ++ if (ret) ++ return ret; ++ } ++ + priv->dev = &pdev->dev; + + stm32_clkevent_lp_init(priv, pdev->dev.parent->of_node, rate); +diff --git a/drivers/hwtracing/coresight/coresight-cti.h b/drivers/hwtracing/coresight/coresight-cti.h +index cb9ee616d01f..9f9eaaf29add 100644 +--- a/drivers/hwtracing/coresight/coresight-cti.h ++++ b/drivers/hwtracing/coresight/coresight-cti.h +@@ -17,6 +17,16 @@ + + #include "coresight-priv.h" + ++#ifdef CONFIG_PREEMPT_RT ++#undef spin_lock_init ++#define spin_lock_init raw_spin_lock_init ++#define spin_lock raw_spin_lock ++#define spin_unlock raw_spin_unlock ++#undef spin_lock_irqsave ++#define spin_lock_irqsave raw_spin_lock_irqsave ++#define spin_unlock_irqrestore raw_spin_unlock_irqrestore ++#define spinlock_t raw_spinlock_t ++#endif + /* + * Device registers + * 0x000 - 0x144: CTI programming and status +diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c +index df2e456430d4..7bb8eb972433 100644 +--- a/drivers/mfd/syscon.c ++++ b/drivers/mfd/syscon.c +@@ -36,6 +36,9 @@ static const struct regmap_config syscon_regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, ++#ifdef CONFIG_PREEMPT_RT ++ .use_raw_spinlock = true, ++#endif + }; + + static struct syscon *of_syscon_register(struct device_node *np, bool check_res) +diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c +index f13c1bba5fe7..d22de65d7dc7 100644 +--- a/drivers/tty/serial/stm32-usart.c ++++ b/drivers/tty/serial/stm32-usart.c +@@ -847,7 +847,7 @@ static void stm32_usart_tx_dma_complete(void *arg) + /* Let's see if we have pending data to send */ + stm32_usart_transmit_chars(port); + +- uart_port_lock_irqsave(port, &flags); ++ uart_port_unlock_irqrestore(port, flags); + + pm_runtime_mark_last_busy(port->dev); + pm_runtime_put_autosuspend(port->dev); +@@ -1353,7 +1353,7 @@ static void stm32_usart_break_ctl(struct uart_port *port, int break_state) + + pm_runtime_get(port->dev); + +- spin_lock_irqsave(&port->lock, flags); ++ uart_port_lock_irqsave(port, &flags); + + if (break_state) { + if (long_break) { +@@ -1370,7 +1370,7 @@ static void stm32_usart_break_ctl(struct uart_port *port, int break_state) + stm32_usart_clr_bits(port, ofs->rqr, USART_RQR_SBKRQ); + } + +- spin_unlock_irqrestore(&port->lock, flags); ++ uart_port_unlock_irqrestore(port, flags); + + pm_runtime_mark_last_busy(port->dev); + pm_runtime_put_autosuspend(port->dev); +@@ -2500,7 +2500,7 @@ static int __maybe_unused stm32_usart_serial_en_wakeup(struct uart_port *port, + } + + /* Poll data from RX FIFO if any */ +- spin_lock_irqsave(&port->lock, flags); ++ uart_port_lock_irqsave(port, &flags); + size = stm32_usart_receive_chars(port, false); + if (size) + tty_flip_buffer_push(tport); +-- diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey_6.6.bb b/meta-digi-arm/recipes-kernel/linux/linux-dey_6.6.bb index 5838821cd..beda8a18f 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey_6.6.bb +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey_6.6.bb @@ -21,8 +21,8 @@ RT_FILES:use-nxp-bsp = " \ file://fragment-nxp-rt.config \ " RT_FILES:stm32mpcommon = " \ - file://0010-Rebase-on-v6.6.78-rt51.patch \ - file://0011-v6.6-stm32mp-rt-r2.patch \ + file://0010-Rebase-on-v6.6.116-rt66.patch \ + file://0011-v6.6-stm32mp-rt-r3.patch \ file://fragment-08-deactivate-rng.config \ file://fragment-10-network-improvment.config \ "