From c5e8e224eb7ac003edcebfc7a00cefc38063bd18 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Thu, 30 Apr 2026 13:23:13 +0200 Subject: [PATCH 01/41] MIPS: RB532: attach the software node to its target GPIO controller GPIOLIB wants to remove the software node's name matching against GPIO controller's label that is going on behind the scenes in software node lookup. To that end, we need to convert all existing users to using software nodes actually attached to the GPIO devices they represent. In order to use an attached software node with the GPIO controller on rb532: convert the GPIO module into a real platform device, provide platform device info for it in device.c and assign the software node using its swnode field. The software node will get inherited by the GPIO chip from the parent platform device in devm_gpiochip_add_data() as we don't set the fwnode using any other of the mechanisms. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Signed-off-by: Thomas Bogendoerfer --- arch/mips/rb532/devices.c | 32 ++++++++++++++++++++++++------ arch/mips/rb532/gpio.c | 41 ++++++++++++++++++++------------------- 2 files changed, 47 insertions(+), 26 deletions(-) diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c index c3d8d96d0ef5..a6e3dc11298b 100644 --- a/arch/mips/rb532/devices.c +++ b/arch/mips/rb532/devices.c @@ -240,6 +240,25 @@ static struct platform_device *rb532_devs[] = { &rb532_wdt }; +#define GPIOBASE 0x050000 + +static struct resource rb532_gpio_reg0_res[] = { + { + .name = "gpio_reg0", + .start = REGBASE + GPIOBASE, + .end = REGBASE + GPIOBASE + sizeof(struct rb532_gpio_reg) - 1, + .flags = IORESOURCE_MEM, + } +}; + +static struct platform_device_info rb532_gpio_devinfo = { + .name = "rb532-gpio", + .id = PLATFORM_DEVID_NONE, + .res = rb532_gpio_reg0_res, + .num_res = ARRAY_SIZE(rb532_gpio_reg0_res), + .swnode = &rb532_gpio0_node, +}; + static const struct property_entry rb532_button_properties[] = { PROPERTY_ENTRY_GPIO("button-gpios", &rb532_gpio0_node, GPIO_BTN_S1, GPIO_ACTIVE_LOW), @@ -309,17 +328,18 @@ static int __init plat_setup_devices(void) /* set the uart clock to the current cpu frequency */ rb532_uart_res[0].uartclk = idt_cpu_freq; + pd = platform_device_register_full(&rb532_gpio_devinfo); + ret = PTR_ERR_OR_ZERO(pd); + if (ret) { + pr_err("failed to create the GPIO device: %d\n", ret); + return ret; + } + gpiod_add_lookup_table(&cf_slot0_gpio_table); ret = platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs)); if (ret) return ret; - /* - * Stack devices using full info and properties here, after we - * register the node for the GPIO chip. - */ - software_node_register(&rb532_gpio0_node); - pd = platform_device_register_full(&nand0_info); ret = PTR_ERR_OR_ZERO(pd); if (ret) { diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c index 9aa5ef374465..49e1a15a3827 100644 --- a/arch/mips/rb532/gpio.c +++ b/arch/mips/rb532/gpio.c @@ -37,7 +37,6 @@ #include #include -#define GPIOBASE 0x050000 /* Offsets relative to GPIOBASE */ #define GPIOFUNC 0x00 #define GPIOCFG 0x04 @@ -52,15 +51,6 @@ struct rb532_gpio_chip { void __iomem *regbase; }; -static struct resource rb532_gpio_reg0_res[] = { - { - .name = "gpio_reg0", - .start = REGBASE + GPIOBASE, - .end = REGBASE + GPIOBASE + sizeof(struct rb532_gpio_reg) - 1, - .flags = IORESOURCE_MEM, - } -}; - /* rb532_set_bit - sanely set a bit * * bitval: new value for the bit @@ -199,21 +189,32 @@ void rb532_gpio_set_func(unsigned gpio) } EXPORT_SYMBOL(rb532_gpio_set_func); -static int __init rb532_gpio_init(void) +static int rb532_gpio_probe(struct platform_device *pdev) { - struct resource *r; + struct device *dev = &pdev->dev; + struct resource *res; - r = rb532_gpio_reg0_res; - rb532_gpio_chip->regbase = ioremap(r->start, resource_size(r)); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; - if (!rb532_gpio_chip->regbase) { - printk(KERN_ERR "rb532: cannot remap GPIO register 0\n"); - return -ENXIO; - } + rb532_gpio_chip->regbase = devm_ioremap_resource(dev, res); + if (IS_ERR(rb532_gpio_chip->regbase)) + return PTR_ERR(rb532_gpio_chip->regbase); /* Register our GPIO chip */ - gpiochip_add_data(&rb532_gpio_chip->chip, rb532_gpio_chip); + return devm_gpiochip_add_data(dev, &rb532_gpio_chip->chip, rb532_gpio_chip); +} - return 0; +static struct platform_driver rb532_gpio_driver = { + .driver = { + .name = "rb532-gpio", + }, + .probe = rb532_gpio_probe, +}; + +static int __init rb532_gpio_init(void) +{ + return platform_driver_register(&rb532_gpio_driver); } arch_initcall(rb532_gpio_init); From c76cde70457d5f4f6809964b3d9d0a6deaed7fc8 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Thu, 30 Apr 2026 13:24:10 +0200 Subject: [PATCH 02/41] MIPS: RB532: serial: statify setup_serial_port() This function is not used outside of this compilation unit so make it static. Signed-off-by: Bartosz Golaszewski Signed-off-by: Thomas Bogendoerfer --- arch/mips/rb532/serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/rb532/serial.c b/arch/mips/rb532/serial.c index 70482540b3db..228eff07e5e8 100644 --- a/arch/mips/rb532/serial.c +++ b/arch/mips/rb532/serial.c @@ -45,7 +45,7 @@ static struct uart_port rb532_uart = { .regshift = 2 }; -int __init setup_serial_port(void) +static int __init setup_serial_port(void) { rb532_uart.uartclk = idt_cpu_freq; From 8e0780d30b1b51248e42895b7acc7a20f147b40b Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Sat, 2 May 2026 00:14:20 +0100 Subject: [PATCH 03/41] MIPS: Fix big-endian stack argument fetching in o32 wrapper Fix an issue in call_o32() where the upper 32-bit half of incoming n64 stack arguments is fetched and used for outgoing o32 stack arguments on big-endian platforms. This code was adapted from arch/mips/dec/prom/call_o32.S which was meant for a little-endian platform only and therefore using 32-bit loads from 64-bit stack slot locations holding incoming stack arguments resulted in correct values being retrieved for data that is expected to be 32-bit. This works on little-endian platforms where the lower 32-bit half of the 64-bit value is located at every 64-bit stack slot location. However on big-endian platforms the lower 32-bit half is instead located at offset 4 from every 64-bit stack slot location. So to fix the issue the offset of 4 would have to be used on big-endian platforms only, or alternatively a 64-bit load from the 64-bit stack slot location can be used across the board, as the subsequent 32-bit store to the corresponding outgoing stack argument slot will correctly truncate the value and cause no unpredictable result. We already take advantage of this architectural feature for the incoming arguments held in $a6 and $a7 registers, since the o32 wrapper does not know how many incoming arguments there are and consequently propagates incoming data which may not be 32-bit. Since this code is generally supposed to be used with the stack located in cached memory there is no extra overhead expected for 64-bit loads as opposed to 32-bit ones, so pick this variant for code simplicity. Fixes: 231a35d37293 ("[MIPS] RM: Collected changes") Signed-off-by: Maciej W. Rozycki Signed-off-by: Thomas Bogendoerfer --- arch/mips/fw/lib/call_o32.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/fw/lib/call_o32.S b/arch/mips/fw/lib/call_o32.S index ee856709e0b6..77533cfbdfc1 100644 --- a/arch/mips/fw/lib/call_o32.S +++ b/arch/mips/fw/lib/call_o32.S @@ -74,7 +74,7 @@ NESTED(call_o32, O32_FRAMESZ, ra) PTR_LA t1,6*O32_SZREG(fp) li t2,O32_ARGC-6 1: - lw t3,(t0) + ld t3,(t0) REG_ADDU t0,SZREG sw t3,(t1) REG_SUBU t2,1 From a032121b273ec7bcad15812e624d28f0eece6b3f Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Mon, 4 May 2026 21:13:55 +0100 Subject: [PATCH 04/41] MIPS: Make do_IRQ() available for assembly callers As from commit 8f99a1626535 ("MIPS: Tracing: Add IRQENTRY_EXIT section for MIPS") do_IRQ() is not a macro anymore and can be invoked directly from assembly code again, however its `asmlinkage' annotation has never been brought back from the previous removal of the function with commit 187933f23679 ("[MIPS] do_IRQ cleanup"). Since calling the function directly from assembly code has a performance advantage, add the annotation back so that the DEC platform can make use of this again. Signed-off-by: Maciej W. Rozycki Signed-off-by: Thomas Bogendoerfer --- arch/mips/include/asm/irq.h | 2 +- arch/mips/kernel/irq.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h index 3a848e7e69f7..ee5f5245c04a 100644 --- a/arch/mips/include/asm/irq.h +++ b/arch/mips/include/asm/irq.h @@ -54,7 +54,7 @@ static inline int irq_canonicalize(int irq) asmlinkage void plat_irq_dispatch(void); -extern void do_IRQ(unsigned int irq); +asmlinkage void do_IRQ(unsigned int irq); struct irq_domain; extern void do_domain_IRQ(struct irq_domain *domain, unsigned int irq); diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c index 5e11582fe308..4ed73784a800 100644 --- a/arch/mips/kernel/irq.c +++ b/arch/mips/kernel/irq.c @@ -100,7 +100,7 @@ static inline void check_stack_overflow(void) {} * SMP cross-CPU interrupts have their own specific * handlers). */ -void __irq_entry do_IRQ(unsigned int irq) +asmlinkage void __irq_entry do_IRQ(unsigned int irq) { irq_enter(); check_stack_overflow(); From 35554eadc1b127bb5294504a4ac8f3a5dd9e299d Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Mon, 4 May 2026 21:14:00 +0100 Subject: [PATCH 05/41] MIPS: DEC: Remove do_IRQ() call indirection As from commit 8f99a1626535 ("MIPS: Tracing: Add IRQENTRY_EXIT section for MIPS") do_IRQ() is not a macro anymore and can be invoked directly from assembly code, as a tail call. Remove the dec_irq_dispatch() stub then and the indirection previously introduced with commit 187933f23679 ("[MIPS] do_IRQ cleanup"), improving performance by reducing the number of control flow changes and the overall instruction count, while fixing a compiler's complaint about a missing prototype for said stub: arch/mips/dec/setup.c:780:25: warning: no previous prototype for 'dec_irq_dispatch' [-Wmissing-prototypes] 780 | asmlinkage unsigned int dec_irq_dispatch(unsigned int irq) | ^~~~~~~~~~~~~~~~ (which gets promoted to a compilation error with CONFIG_WERROR). Fixes: 8f99a1626535 ("MIPS: Tracing: Add IRQENTRY_EXIT section for MIPS") Signed-off-by: Maciej W. Rozycki Signed-off-by: Thomas Bogendoerfer --- arch/mips/dec/int-handler.S | 2 +- arch/mips/dec/setup.c | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/arch/mips/dec/int-handler.S b/arch/mips/dec/int-handler.S index 011d1d678840..a0b439c90488 100644 --- a/arch/mips/dec/int-handler.S +++ b/arch/mips/dec/int-handler.S @@ -277,7 +277,7 @@ srlv t3,t1,t2 handle_it: - j dec_irq_dispatch + j do_IRQ nop #if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c index 87f0a1436bf9..abe42616498d 100644 --- a/arch/mips/dec/setup.c +++ b/arch/mips/dec/setup.c @@ -776,9 +776,3 @@ void __init arch_init_irq(void) pr_err("Failed to register halt interrupt\n"); } } - -asmlinkage unsigned int dec_irq_dispatch(unsigned int irq) -{ - do_IRQ(irq); - return 0; -} From 0eb77376912eba996cd2bc2a259e8e6a49d5998c Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Mon, 4 May 2026 21:14:08 +0100 Subject: [PATCH 06/41] MIPS: DEC: Fix prototypes for halt/reset handlers Remove a bunch of compilation warnings for halt/reset handlers: arch/mips/dec/reset.c:22:17: warning: no previous prototype for 'dec_machine_restart' [-Wmissing-prototypes] 22 | void __noreturn dec_machine_restart(char *command) | ^~~~~~~~~~~~~~~~~~~ arch/mips/dec/reset.c:27:17: warning: no previous prototype for 'dec_machine_halt' [-Wmissing-prototypes] 27 | void __noreturn dec_machine_halt(void) | ^~~~~~~~~~~~~~~~ arch/mips/dec/reset.c:32:17: warning: no previous prototype for 'dec_machine_power_off' [-Wmissing-prototypes] 32 | void __noreturn dec_machine_power_off(void) | ^~~~~~~~~~~~~~~~~~~~~ arch/mips/dec/reset.c:38:13: warning: no previous prototype for 'dec_intr_halt' [-Wmissing-prototypes] 38 | irqreturn_t dec_intr_halt(int irq, void *dev_id) | ^~~~~~~~~~~~~ (which get promoted to compilation errors with CONFIG_WERROR), by moving the local prototypes from arch/mips/dec/setup.c to a dedicated header for arch/mips/dec/reset.c to use as well. No functional change. Signed-off-by: Maciej W. Rozycki Signed-off-by: Thomas Bogendoerfer --- arch/mips/dec/reset.c | 2 ++ arch/mips/dec/setup.c | 6 +----- arch/mips/include/asm/dec/reset.h | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 arch/mips/include/asm/dec/reset.h diff --git a/arch/mips/dec/reset.c b/arch/mips/dec/reset.c index 3df01f1da347..ee1ad38f4a69 100644 --- a/arch/mips/dec/reset.c +++ b/arch/mips/dec/reset.c @@ -10,6 +10,8 @@ #include +#include + typedef void __noreturn (* noret_func_t)(void); static inline void __noreturn back_to_prom(void) diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c index abe42616498d..78ad28ac16db 100644 --- a/arch/mips/dec/setup.c +++ b/arch/mips/dec/setup.c @@ -48,14 +48,10 @@ #include #include #include +#include #include -extern void dec_machine_restart(char *command); -extern void dec_machine_halt(void); -extern void dec_machine_power_off(void); -extern irqreturn_t dec_intr_halt(int irq, void *dev_id); - unsigned long dec_kn_slot_base, dec_kn_slot_size; EXPORT_SYMBOL(dec_kn_slot_base); diff --git a/arch/mips/include/asm/dec/reset.h b/arch/mips/include/asm/dec/reset.h new file mode 100644 index 000000000000..6af49f3f24da --- /dev/null +++ b/arch/mips/include/asm/dec/reset.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * arch/mips/include/asm/dec/reset.h + * + * DECstation/DECsystem halt/reset support. + * + * Copyright (C) 2026 Maciej W. Rozycki + */ +#ifndef __ASM_DEC_RESET_H +#define __ASM_DEC_RESET_H + +#include + +void __noreturn dec_machine_restart(char *command); +void __noreturn dec_machine_halt(void); +void __noreturn dec_machine_power_off(void); +irqreturn_t dec_intr_halt(int irq, void *dev_id); + +#endif /* __ASM_DEC_RESET_H */ From 04481cd30e8ec8b86b4dc17d0f89dd24845670a0 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Wed, 6 May 2026 12:15:21 +0100 Subject: [PATCH 07/41] MIPS: DEC: Remove IRQF_ONESHOT reference for IOASIC DMA error IRQs There is no need for IOASIC DMA error interrupts to use the IRQF_ONESHOT flag, because while they do need to have the source cleared only at the conclusion of handling, the action handler supplied is either run in the hardirq context with interrupts disabled at the CPU level or, where IRQ threading has been forced, the primary handler has the IRQF_ONESHOT flag implicitly added and therefore the original action handler, now run as the thread handler and with interrupts enabled in the CPU, is executed with the originating interrupt line masked. Therefore no interrupt will retrigger regardless until the original request has been handled. Link: https://lore.kernel.org/r/20260127135334.qUEaYP9G@linutronix.de/ Reported-by: Sebastian Andrzej Siewior Signed-off-by: Maciej W. Rozycki Acked-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Bogendoerfer --- arch/mips/dec/ioasic-irq.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/mips/dec/ioasic-irq.c b/arch/mips/dec/ioasic-irq.c index 971f7b46759b..c690ef33397f 100644 --- a/arch/mips/dec/ioasic-irq.c +++ b/arch/mips/dec/ioasic-irq.c @@ -78,10 +78,7 @@ static struct irq_chip ioasic_dma_irq_type = { * cleared. This cannot be done until after a corrective action has been * taken and this also means they will not retrigger. Therefore they use * the `handle_fasteoi_irq' handler that only clears the request on the - * way out. Because MIPS processor interrupt inputs, one of which the I/O - * ASIC is cascaded to, are level-triggered it is recommended that error - * DMA interrupt action handlers are registered with the IRQF_ONESHOT flag - * set so that they are run with the interrupt line masked. + * way out. * * This mask has `1' bits in the positions of informational interrupts. */ From 5ff79e8bdc75db51e30298a75939e2308e7658e0 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Wed, 6 May 2026 23:42:23 +0100 Subject: [PATCH 08/41] MIPS: DEC: Ensure 32-bit stack location for o32 prom_printf() In 64-bit configurations calling any firmware entry points from a kernel thread other than the initial one will result in a situation where the stack has been placed in the XKPHYS 64-bit memory segment. Consequently the stack pointer is no longer a 32-bit value and when the 32-bit firmware code called uses 32-bit ALU operations to manipulate the stack pointer, the calculated result is incorrect (in fact in the 64-bit MIPS ISA almost all 32-bit ALU operations will produce an unpredictable result when executed on 64-bit data) and control goes astray. This may happen when no final console driver has been enabled in the configuration and consequently the initial console continues being used late into bootstrap, or with an upcoming change that will switch the zs driver to use a platform device, which in turn will make the console handover happen only after other kernel threads have already been started, and the kernel will hang at: pid_max: default: 32768 minimum: 301 or somewhat later, but always before: cblist_init_generic: Setting adjustable number of callback queues. has been printed. It seems that only the prom_printf() entry point is affected. Of all the other entry points wired only rex_slot_address() and rex_gettcinfo() are called from a kernel thread other than the initial one, specifically kernel_init(), and they are leaf functions that do no business with the stack, having worked with no issue ever since 64-bit support was added for the platform back in 2002. To address this issue then, arrange for the stack to be switched in the o32 wrapper as required for prom_printf() only, by supplying call_o32() with a pointer to a chunk of initdata space, which is placed in the CKSEG0 32-bit compatibility segment, observing that prom_printf() is only called from console output handler and therefore with the console lock held, implying no need for this code to be reentrant. Other firmware entry points may be called with interrupts enabled and no lock held, and may therefore require that call_o32() be reentrant. They trigger no issue at this point and "if it ain't broke, don't fix it," so just leave them alone. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Maciej W. Rozycki Cc: stable@vger.kernel.org # v2.6.12+ Signed-off-by: Thomas Bogendoerfer --- arch/mips/dec/prom/init.c | 6 +++++- arch/mips/include/asm/dec/prom.h | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/arch/mips/dec/prom/init.c b/arch/mips/dec/prom/init.c index 8d74d7d6c05b..e46c7accefff 100644 --- a/arch/mips/dec/prom/init.c +++ b/arch/mips/dec/prom/init.c @@ -3,7 +3,7 @@ * init.c: PROM library initialisation code. * * Copyright (C) 1998 Harald Koerfgen - * Copyright (C) 2002, 2004 Maciej W. Rozycki + * Copyright (C) 2002, 2004, 2026 Maciej W. Rozycki */ #include #include @@ -20,6 +20,10 @@ #include +#ifdef CONFIG_64BIT +unsigned long o32_stk[O32_STK_SIZE] __initdata = { 0 }; +#endif + int (*__rex_bootinit)(void); int (*__rex_bootread)(void); int (*__rex_getbitmap)(memmap *); diff --git a/arch/mips/include/asm/dec/prom.h b/arch/mips/include/asm/dec/prom.h index 8fcad6984389..af068e634f1e 100644 --- a/arch/mips/include/asm/dec/prom.h +++ b/arch/mips/include/asm/dec/prom.h @@ -4,7 +4,7 @@ * * DECstation PROM interface. * - * Copyright (C) 2002 Maciej W. Rozycki + * Copyright (C) 2002, 2026 Maciej W. Rozycki * * Based on arch/mips/dec/prom/prom.h by the Anonymous. */ @@ -97,6 +97,17 @@ extern int (*__pmax_close)(int); #ifdef CONFIG_64BIT +#define O32_STK_SIZE 512 +extern unsigned long o32_stk[]; + +/* Switch the stack if outside the 32-bit address space. */ +static inline unsigned long *o32_get_stk(void) +{ + long fp = (long)__builtin_frame_address(0); + + return fp != (int)fp ? o32_stk + O32_STK_SIZE : NULL; +} + /* * On MIPS64 we have to call PROM functions via a helper * dispatcher to accommodate ABI incompatibilities. @@ -128,7 +139,7 @@ int __DEC_PROM_O32(_prom_printf, (int (*)(char *, ...), void *, char *, ...)); #define prom_getchar() _prom_getchar(__prom_getchar, NULL) #define prom_getenv(x) _prom_getenv(__prom_getenv, NULL, x) -#define prom_printf(x...) _prom_printf(__prom_printf, NULL, x) +#define prom_printf(x...) _prom_printf(__prom_printf, o32_get_stk(), x) #else /* !CONFIG_64BIT */ From 7fb13fd35110ebe95eb053faf79d018f51144d85 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Wed, 6 May 2026 23:42:27 +0100 Subject: [PATCH 09/41] MIPS: DEC: Prevent initial console buffer from landing in XKPHYS In 64-bit configurations calling the initial console output handler from a kernel thread other than the initial one will result in a situation where the stack has been placed in the XKPHYS 64-bit memory segment and consequently so has been the buffer allocated there that is used as the argument corresponding to the `%s' output conversion specifier for the firmware's printf() entry point. This 64-bit address will then be truncated by 32-bit firmware, resulting in an attempt to access the wrong memory location, which in turn will cause all kinds of unpredictable behaviour, such as a kernel crash: Console: colour dummy device 160x64 Calibrating delay loop... 49.36 BogoMIPS (lpj=192512) pid_max: default: 32768 minimum: 301 CPU 0 Unable to handle kernel paging request at virtual address 000000000203bd00, epc == ffffffffbfc08364, ra == ffffffffbfc08800 Oops[#1]: CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0-rc2-00254-gfb649bda6f56-dirty #121 $ 0 : 0000000000000000 0000000000000001 0000000000000023 ffffffff80684ba0 $ 4 : 000000000203bd00 ffffffffbfc0f3b4 ffffffffffffffff 0000000000000073 $ 8 : 0a303d7469000000 0000000000000000 0000000000000073 ffffffffbfc0f473 $12 : 0000000000000002 0000000000000000 ffffffff80684c1c 0000000000000000 $16 : 0000000000000000 ffffffff80596dc9 0000000000000000 ffffffffbfc09240 $20 : ffffffff80684c40 ffffffffbfc0f400 000000000000002d 000000000000002b $24 : ffffffffffffffbf 000000000203bd00 $28 : ffffffff805f0000 ffffffff80684b58 0000000000000030 ffffffffbfc08800 Hi : 0000000000000000 Lo : 0000000000000aa8 epc : ffffffffbfc08364 0xffffffffbfc08364 ra : ffffffffbfc08800 0xffffffffbfc08800 Status: 140120e2 KX SX UX KERNEL EXL Cause : 00000008 (ExcCode 02) BadVA : 000000000203bd00 PrId : 00000430 (R4000SC) Modules linked in: Process swapper (pid: 0, threadinfo=(____ptrval____), task=(____ptrval____), tls=0000000000000000) Stack : 0000000000000000 0000000000000000 0000000000000000 0000004d0000004d 80684cc0806a2a40 80596dc80000004d 8061000000000000 bfc0850c80684c38 0000000000000000 000000000203bd00 0000000000000000 0000000000000000 0000000000000000 00000000bfc0f3b4 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000002500000000 0000000000000000 0000000000000000 802c1a7400000000 0203bd0080596dc8 0203bd4d69000000 6c61632000000018 5f746567646e6172 6c616320625f6d6f 5f736e5f6d6f7266 206361323778302b 303d74696e726320 806a0a38806b0000 806a0a38806b0000 00000000806b0000 80683c58806b0000 ... Call Trace: Code: a082ffff 03e00008 00601021 <80820000> 00001821 10400005 24840001 80820000 24630001 ---[ end trace 0000000000000000 ]--- Kernel panic - not syncing: Fatal exception in interrupt KN04 V2.1k (PC: 0xa0026768, SP: 0x806848e8) >> In this case the pointer in $4 was truncated from 0x980000000203bd00 to 0x000000000203bd00. This may happen when no final console driver has been enabled in the configuration and consequently the initial console continues being used late into bootstrap or with an upcoming change that will switch the zs driver to use a platform device, which in turn will make the console handover happen only after other kernel threads have already been started. Fix the issue by making the buffer static and initdata, and therefore placed in the CKSEG0 32-bit compatibility segment, observing that the console output handler is called with the console lock held, implying no need for this code to be reentrant. Add an assertion to verify the buffer actually has been placed in a compatibility segment. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Maciej W. Rozycki Cc: stable@vger.kernel.org # v2.6.12+ Signed-off-by: Thomas Bogendoerfer --- arch/mips/dec/prom/console.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/mips/dec/prom/console.c b/arch/mips/dec/prom/console.c index 31a8441d8431..b4f0dba3fa20 100644 --- a/arch/mips/dec/prom/console.c +++ b/arch/mips/dec/prom/console.c @@ -2,8 +2,9 @@ /* * DECstation PROM-based early console support. * - * Copyright (C) 2004, 2007 Maciej W. Rozycki + * Copyright (C) 2004, 2007, 2026 Maciej W. Rozycki */ +#include #include #include #include @@ -14,9 +15,11 @@ static void __init prom_console_write(struct console *con, const char *s, unsigned int c) { - char buf[81]; + static char buf[81] __initdata = { 0 }; unsigned int chunk = sizeof(buf) - 1; + BUG_ON((long)buf != (int)(long)buf); + while (c > 0) { if (chunk > c) chunk = c; From e5d64f868e484da06f5c141c18c32c01c269625e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 7 May 2026 16:23:23 -0700 Subject: [PATCH 10/41] mips: cps: Assemble jr.hb with an R2 ISA level A MIPS allmodconfig built with LLVM can select CPU_MIPS32_R1 together with MIPS_MT_SMP. In that configuration clang invokes the integrated assembler with -march=mips32, and the MIPS MT path in cps-vec.S fails to assemble two jr.hb instructions: arch/mips/kernel/cps-vec.S:376:2: error: instruction requires a CPU feature not currently enabled arch/mips/kernel/cps-vec.S:490:4: error: instruction requires a CPU feature not currently enabled The earlier jr.hb in the same file is already assembled inside a .set MIPS_ISA_LEVEL_RAW scope. The two failing sites are reached after popping back to the file's base ISA level, so LLVM correctly rejects them for an R1 target. Wrap those jr.hb instructions in the same ISA-level push/pop used by the working site. This keeps the MT code unchanged while making the required R2 hazard-branch encoding explicit to the assembler. Assisted-by: Codex:GPT-5.5 Signed-off-by: Rosen Penev Reviewed-by: Maciej W. Rozycki Signed-off-by: Thomas Bogendoerfer --- arch/mips/kernel/cps-vec.S | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S index 2ae7034a3d5c..70413c816eb0 100644 --- a/arch/mips/kernel/cps-vec.S +++ b/arch/mips/kernel/cps-vec.S @@ -373,8 +373,11 @@ LEAF(mips_cps_boot_vpes) .set pop PTR_LA t1, 1f + .set push + .set MIPS_ISA_LEVEL_RAW jr.hb t1 nop + .set pop 1: mfc0 t1, CP0_MVPCONTROL ori t1, t1, MVPCONTROL_VPC mtc0 t1, CP0_MVPCONTROL @@ -487,8 +490,11 @@ LEAF(mips_cps_boot_vpes) li t0, TCHALT_H mtc0 t0, CP0_TCHALT PTR_LA t0, 1f + .set push + .set MIPS_ISA_LEVEL_RAW 1: jr.hb t0 nop + .set pop 2: From 4ddaf88aadd3bd09c2eb3734c53d2864af6b144e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 7 May 2026 21:27:24 -0700 Subject: [PATCH 11/41] mips: ralink: mt7621: add missing __iomem raw_readl and writel calls expect pointers annotated with __iomem. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild/202211060456.cnV6IK6G-lkp@intel.com/ Fixes: cc19db8b312a ("MIPS: ralink: mt7621: do memory detection on KSEG1") Signed-off-by: Rosen Penev Reviewed-by: Sergio Paracuellos Signed-off-by: Thomas Bogendoerfer --- arch/mips/ralink/mt7621.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/ralink/mt7621.c b/arch/mips/ralink/mt7621.c index a4bdda8541c0..ae7b8cfedd5f 100644 --- a/arch/mips/ralink/mt7621.c +++ b/arch/mips/ralink/mt7621.c @@ -63,7 +63,7 @@ phys_addr_t mips_cpc_default_phys_base(void) static bool __init mt7621_addr_wraparound_test(phys_addr_t size) { - void *dm = (void *)KSEG1ADDR(&detect_magic); + void __iomem *dm = (void __iomem *)KSEG1ADDR(&detect_magic); if (CPHYSADDR(dm + size) >= MT7621_LOWMEM_MAX_SIZE) return true; From 579f5329d5df2dbcf4bb5ef398701c2501d24892 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 8 May 2026 20:57:27 -0700 Subject: [PATCH 12/41] mips: n64: add __iomem for writel call sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *mem @@ got unsigned int [usertype] * Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202105261445.AcvPd2EE-lkp@intel.com/ Fixes: baec970aa5ba ("mips: Add N64 machine type") Signed-off-by: Rosen Penev Signed-off-by: Thomas Bogendoerfer --- arch/mips/n64/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/n64/init.c b/arch/mips/n64/init.c index dfbd864f4667..66ec28ab41f3 100644 --- a/arch/mips/n64/init.c +++ b/arch/mips/n64/init.c @@ -50,7 +50,7 @@ void __init prom_init(void) #define W 320 #define H 240 -#define REG_BASE ((u32 *) CKSEG1ADDR(0x4400000)) +#define REG_BASE ((u32 __iomem *) CKSEG1ADDR(0x4400000)) static void __init n64rdp_write_reg(const u8 reg, const u32 value) { From 56388011db71026e04ffe9963c816269f0bb3165 Mon Sep 17 00:00:00 2001 From: Costa Shulyupin Date: Fri, 15 May 2026 21:42:23 +0300 Subject: [PATCH 13/41] include: Remove unused jz4740-adc.h The last user was the JZ4740 MFD ADC driver, removed in commit ff71266aa490 ("mfd: Drop obsolete JZ4740 driver") and replaced by a self-contained IIO driver. No file includes or references this header. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Costa Shulyupin Signed-off-by: Thomas Bogendoerfer --- include/linux/jz4740-adc.h | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 include/linux/jz4740-adc.h diff --git a/include/linux/jz4740-adc.h b/include/linux/jz4740-adc.h deleted file mode 100644 index 19d995c8bf06..000000000000 --- a/include/linux/jz4740-adc.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - -#ifndef __LINUX_JZ4740_ADC -#define __LINUX_JZ4740_ADC - -struct device; - -/* - * jz4740_adc_set_config - Configure a JZ4740 adc device - * @dev: Pointer to a jz4740-adc device - * @mask: Mask for the config value to be set - * @val: Value to be set - * - * This function can be used by the JZ4740 ADC mfd cells to configure their - * options in the shared config register. -*/ -int jz4740_adc_set_config(struct device *dev, uint32_t mask, uint32_t val); - -#define JZ_ADC_CONFIG_SPZZ BIT(31) -#define JZ_ADC_CONFIG_EX_IN BIT(30) -#define JZ_ADC_CONFIG_DNUM_MASK (0x7 << 16) -#define JZ_ADC_CONFIG_DMA_ENABLE BIT(15) -#define JZ_ADC_CONFIG_XYZ_MASK (0x2 << 13) -#define JZ_ADC_CONFIG_SAMPLE_NUM_MASK (0x7 << 10) -#define JZ_ADC_CONFIG_CLKDIV_MASK (0xf << 5) -#define JZ_ADC_CONFIG_BAT_MB BIT(4) - -#define JZ_ADC_CONFIG_DNUM(dnum) ((dnum) << 16) -#define JZ_ADC_CONFIG_XYZ_OFFSET(dnum) ((xyz) << 13) -#define JZ_ADC_CONFIG_SAMPLE_NUM(x) ((x) << 10) -#define JZ_ADC_CONFIG_CLKDIV(div) ((div) << 5) - -#endif From eb013e9685e2ec6e608bbeb79e7ce98782fdcc63 Mon Sep 17 00:00:00 2001 From: Costa Shulyupin Date: Fri, 15 May 2026 21:50:41 +0300 Subject: [PATCH 14/41] include: Remove unused jz4740-battery.h The last user was removed in commit aea12071d6fc ("power/supply: Drop obsolete JZ4740 driver") and replaced by a self-contained IIO-based driver. No file includes this header. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Costa Shulyupin Signed-off-by: Thomas Bogendoerfer --- include/linux/power/jz4740-battery.h | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 include/linux/power/jz4740-battery.h diff --git a/include/linux/power/jz4740-battery.h b/include/linux/power/jz4740-battery.h deleted file mode 100644 index 10da211678c8..000000000000 --- a/include/linux/power/jz4740-battery.h +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (C) 2009, Jiejing Zhang - */ - -#ifndef __JZ4740_BATTERY_H -#define __JZ4740_BATTERY_H - -struct jz_battery_platform_data { - struct power_supply_info info; - int gpio_charge; /* GPIO port of Charger state */ - int gpio_charge_active_low; -}; - -#endif From 1dc85756b759c3ecd21a22b0aef84ed41ddc7596 Mon Sep 17 00:00:00 2001 From: Qingfang Deng Date: Tue, 28 Apr 2026 16:25:40 +0800 Subject: [PATCH 15/41] MIPS: ralink: reduce ARCH_DMA_MINALIGN Currently, Ralink SoCs use the default ARCH_DMA_MINALIGN value of 128 bytes defined in mach-generic. This is excessive for these platforms and leads to significant memory waste in kmalloc. Override ARCH_DMA_MINALIGN to use L1_CACHE_BYTES, which is 16 bytes for RT288X and 32 bytes for other Ralink SoCs. Signed-off-by: Qingfang Deng Signed-off-by: Thomas Bogendoerfer --- arch/mips/include/asm/mach-ralink/kmalloc.h | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 arch/mips/include/asm/mach-ralink/kmalloc.h diff --git a/arch/mips/include/asm/mach-ralink/kmalloc.h b/arch/mips/include/asm/mach-ralink/kmalloc.h new file mode 100644 index 000000000000..1693209d3f37 --- /dev/null +++ b/arch/mips/include/asm/mach-ralink/kmalloc.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_MACH_RALINK_KMALLOC_H +#define __ASM_MACH_RALINK_KMALLOC_H + +#ifdef CONFIG_DMA_NONCOHERENT +#define ARCH_DMA_MINALIGN L1_CACHE_BYTES +#endif + +#endif /* __ASM_MACH_RALINK_KMALLOC_H */ From 1cb79c435a2ff812f7b9e9318962fda4b4663347 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sat, 25 Apr 2026 20:03:32 -0400 Subject: [PATCH 16/41] MIPS: mobileye: Remove duplicate FIT_IMAGE_FDT_EPM5 from main Kconfig kconfiglint reports: K008: config FIT_IMAGE_FDT_EPM5 has prompts in 2 separate definitions The FIT_IMAGE_FDT_EPM5 Kconfig symbol is defined identically in two places: arch/mips/Kconfig:1052 arch/mips/mobileye/Kconfig:17 Both have the same prompt, depends, default, and help text. Since arch/mips/mobileye/Kconfig is sourced from arch/mips/Kconfig, both definitions are parsed and the symbol ends up with two prompts. The symbol was first introduced in commit 101bd58fde10 ("MIPS: Add support for Mobileye EyeQ5") directly in arch/mips/Kconfig. Three months later, commit fbe0fae601b7 ("MIPS: mobileye: Add EyeQ6H support") created the arch/mips/mobileye/Kconfig sub-file to organize the growing Mobileye platform code and added the MACH_EYEQ5/MACH_EYEQ6H choice along with a copy of FIT_IMAGE_FDT_EPM5. However, the original definition in arch/mips/Kconfig was not removed at that time, leaving a duplicate. Remove the definition from arch/mips/Kconfig, keeping the one in arch/mips/mobileye/Kconfig where it belongs alongside the related MACH_EYEQ5 machine type definition that it depends on. Assisted-by: Claude:claude-opus-4-6 kconfiglint Signed-off-by: Sasha Levin Signed-off-by: Thomas Bogendoerfer --- arch/mips/Kconfig | 9 --------- 1 file changed, 9 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 4364f3dba688..1cd8fc903387 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -1049,15 +1049,6 @@ config CAVIUM_OCTEON_SOC endchoice -config FIT_IMAGE_FDT_EPM5 - bool "Include FDT for Mobileye EyeQ5 development platforms" - depends on MACH_EYEQ5 - default n - help - Enable this to include the FDT for the EyeQ5 development platforms - from Mobileye in the FIT kernel image. - This requires u-boot on the platform. - source "arch/mips/alchemy/Kconfig" source "arch/mips/ath25/Kconfig" source "arch/mips/ath79/Kconfig" From 62d6592cb28882bc693df6c04276ebf41c931013 Mon Sep 17 00:00:00 2001 From: Icenowy Zheng Date: Sat, 11 Apr 2026 18:17:43 +0800 Subject: [PATCH 17/41] MIPS: Loongson64: dts: Sort nodes The RTC's address is after UARTs, however the node is currently before them. Re-order the node to match address sequence. Signed-off-by: Icenowy Zheng Acked-by: Jiaxun Yang Signed-off-by: Thomas Bogendoerfer --- arch/mips/boot/dts/loongson/ls7a-pch.dtsi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/mips/boot/dts/loongson/ls7a-pch.dtsi b/arch/mips/boot/dts/loongson/ls7a-pch.dtsi index 6dee85909f5a..59ca1ef0a7b6 100644 --- a/arch/mips/boot/dts/loongson/ls7a-pch.dtsi +++ b/arch/mips/boot/dts/loongson/ls7a-pch.dtsi @@ -19,13 +19,6 @@ pic: interrupt-controller@10000000 { #interrupt-cells = <2>; }; - rtc0: rtc@100d0100 { - compatible = "loongson,ls7a-rtc"; - reg = <0 0x100d0100 0 0x78>; - interrupt-parent = <&pic>; - interrupts = <52 IRQ_TYPE_LEVEL_HIGH>; - }; - ls7a_uart0: serial@10080000 { compatible = "ns16550a"; reg = <0 0x10080000 0 0x100>; @@ -65,6 +58,13 @@ ls7a_uart3: serial@10080300 { no-loopback-test; }; + rtc0: rtc@100d0100 { + compatible = "loongson,ls7a-rtc"; + reg = <0 0x100d0100 0 0x78>; + interrupt-parent = <&pic>; + interrupts = <52 IRQ_TYPE_LEVEL_HIGH>; + }; + pci@1a000000 { compatible = "loongson,ls7a-pci"; device_type = "pci"; From 8b498817d62c3e6c4ded294e8822159ea9a9a1f0 Mon Sep 17 00:00:00 2001 From: Icenowy Zheng Date: Sat, 11 Apr 2026 18:17:44 +0800 Subject: [PATCH 18/41] MIPS: Loongson64: dts: Add node for LS7A PCH LPC Loongson 7A series PCH contain a LPC IRQ controller. Add the device tree node of it. Signed-off-by: Icenowy Zheng Acked-by: Jiaxun Yang Signed-off-by: Thomas Bogendoerfer --- arch/mips/boot/dts/loongson/ls7a-pch.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/mips/boot/dts/loongson/ls7a-pch.dtsi b/arch/mips/boot/dts/loongson/ls7a-pch.dtsi index 59ca1ef0a7b6..f304f99946f1 100644 --- a/arch/mips/boot/dts/loongson/ls7a-pch.dtsi +++ b/arch/mips/boot/dts/loongson/ls7a-pch.dtsi @@ -19,6 +19,15 @@ pic: interrupt-controller@10000000 { #interrupt-cells = <2>; }; + lpc: interrupt-controller@10002000 { + compatible = "loongson,ls7a-lpc"; + reg = <0 0x10002000 0 0x1000>; + interrupt-controller; + interrupt-parent = <&pic>; + interrupts = <19 IRQ_TYPE_LEVEL_HIGH>; + #interrupt-cells = <2>; + }; + ls7a_uart0: serial@10080000 { compatible = "ns16550a"; reg = <0 0x10080000 0 0x100>; From c62cdd3e919bdf84c37ec46810f87cdb1736e822 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Fri, 24 Apr 2026 12:28:45 +0200 Subject: [PATCH 19/41] MIPS: ip22-gio: fix kfree() of static object The gio bus root device is a statically allocated object which must not be freed by kfree() on failure to register the device or bus. Fixes: 82242d28ff8b ("MIPS: IP22: Add missing put_device call") Cc: stable@vger.kernel.org # 3.17 Cc: Levente Kurusa Signed-off-by: Johan Hovold Signed-off-by: Thomas Bogendoerfer --- arch/mips/sgi-ip22/ip22-gio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c index 9eec8842ffb7..a574441fa44b 100644 --- a/arch/mips/sgi-ip22/ip22-gio.c +++ b/arch/mips/sgi-ip22/ip22-gio.c @@ -30,7 +30,6 @@ static struct { static void gio_bus_release(struct device *dev) { - kfree(dev); } static struct device gio_bus = { From 7de9a1b45f5a95b58145653c525c8fb80292d9ab Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Fri, 24 Apr 2026 12:28:46 +0200 Subject: [PATCH 20/41] MIPS: ip22-gio: fix gio device memory leak The gio device release callback was never wired up so gio devices are not freed when the last reference is dropped. Fixes: e84de0c61905 ("MIPS: GIO bus support for SGI IP22/28") Cc: stable@vger.kernel.org # 3.3 Cc: Thomas Bogendoerfer Signed-off-by: Johan Hovold Signed-off-by: Thomas Bogendoerfer --- arch/mips/sgi-ip22/ip22-gio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c index a574441fa44b..2f5c6c6f8254 100644 --- a/arch/mips/sgi-ip22/ip22-gio.c +++ b/arch/mips/sgi-ip22/ip22-gio.c @@ -100,6 +100,8 @@ int gio_device_register(struct gio_device *giodev) { giodev->dev.bus = &gio_bus_type; giodev->dev.parent = &gio_bus; + giodev->dev.release = gio_release_dev; + return device_register(&giodev->dev); } EXPORT_SYMBOL_GPL(gio_device_register); From b82930a4c5dbc5c4df39c0f93d968c239f2c6885 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Fri, 24 Apr 2026 12:28:47 +0200 Subject: [PATCH 21/41] MIPS: ip22-gio: fix device reference leak in probe The gio probe function needlessly takes a device reference which is never released and therefore prevents unbound gio devices from being freed. Fixes: e84de0c61905 ("MIPS: GIO bus support for SGI IP22/28") Cc: stable@vger.kernel.org # 3.3 Cc: Thomas Bogendoerfer Signed-off-by: Johan Hovold Signed-off-by: Thomas Bogendoerfer --- arch/mips/sgi-ip22/ip22-gio.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c index 2f5c6c6f8254..7b7572d11250 100644 --- a/arch/mips/sgi-ip22/ip22-gio.c +++ b/arch/mips/sgi-ip22/ip22-gio.c @@ -133,13 +133,9 @@ static int gio_device_probe(struct device *dev) if (!drv->probe) return error; - gio_dev_get(gio_dev); - match = gio_match_device(drv->id_table, gio_dev); if (match) error = drv->probe(gio_dev, match); - if (error) - gio_dev_put(gio_dev); return error; } From b8f0962b3f4e603d76e610484b0ef81c5e3325fe Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Fri, 24 Apr 2026 12:28:48 +0200 Subject: [PATCH 22/41] MIPS: ip22-gio: switch to dynamic root device Driver core expects devices to be dynamically allocated and will, for example, complain loudly when no release function has been provided. Use root_device_register() to allocate and register the root device instead of open coding using a static device. Signed-off-by: Johan Hovold Signed-off-by: Thomas Bogendoerfer --- arch/mips/sgi-ip22/ip22-gio.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c index 7b7572d11250..d29067430b44 100644 --- a/arch/mips/sgi-ip22/ip22-gio.c +++ b/arch/mips/sgi-ip22/ip22-gio.c @@ -28,14 +28,7 @@ static struct { { .name = "SGI GR2/GR3", .id = 0x7f }, }; -static void gio_bus_release(struct device *dev) -{ -} - -static struct device gio_bus = { - .init_name = "gio", - .release = &gio_bus_release, -}; +static struct device *gio_bus; /** * gio_match_device - Tell if an of_device structure has a matching @@ -99,7 +92,7 @@ EXPORT_SYMBOL_GPL(gio_release_dev); int gio_device_register(struct gio_device *giodev) { giodev->dev.bus = &gio_bus_type; - giodev->dev.parent = &gio_bus; + giodev->dev.parent = gio_bus; giodev->dev.release = gio_release_dev; return device_register(&giodev->dev); @@ -397,11 +390,9 @@ static int __init ip22_gio_init(void) unsigned int pbdma __maybe_unused; int ret; - ret = device_register(&gio_bus); - if (ret) { - put_device(&gio_bus); - return ret; - } + gio_bus = root_device_register("gio"); + if (IS_ERR(gio_bus)) + return PTR_ERR(gio_bus); ret = bus_register(&gio_bus_type); if (!ret) { @@ -420,8 +411,9 @@ static int __init ip22_gio_init(void) ip22_check_gio(1, GIO_SLOT_EXP0_BASE, SGI_GIOEXP0_IRQ); ip22_check_gio(2, GIO_SLOT_EXP1_BASE, SGI_GIOEXP1_IRQ); } - } else - device_unregister(&gio_bus); + } else { + root_device_unregister(gio_bus); + } return ret; } From 4d9dd68708f814ddeef4015bc67f2b13d192d0be Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Fri, 24 Apr 2026 12:28:49 +0200 Subject: [PATCH 23/41] MIPS: ip22-gio: do not export device release function There is no need to export the gio device release function as the devices are reference counted. Drop the export along with the unused inline wrapper. Signed-off-by: Johan Hovold Signed-off-by: Thomas Bogendoerfer --- arch/mips/include/asm/gio_device.h | 6 ------ arch/mips/sgi-ip22/ip22-gio.c | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/arch/mips/include/asm/gio_device.h b/arch/mips/include/asm/gio_device.h index 159087f5386e..f9c102f038d6 100644 --- a/arch/mips/include/asm/gio_device.h +++ b/arch/mips/include/asm/gio_device.h @@ -37,12 +37,6 @@ extern void gio_dev_put(struct gio_device *); extern int gio_device_register(struct gio_device *); extern void gio_device_unregister(struct gio_device *); -extern void gio_release_dev(struct device *); - -static inline void gio_device_free(struct gio_device *dev) -{ - gio_release_dev(&dev->dev); -} extern int gio_register_driver(struct gio_driver *); extern void gio_unregister_driver(struct gio_driver *); diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c index d29067430b44..54e17c8693e2 100644 --- a/arch/mips/sgi-ip22/ip22-gio.c +++ b/arch/mips/sgi-ip22/ip22-gio.c @@ -80,14 +80,13 @@ EXPORT_SYMBOL_GPL(gio_dev_put); * Will be called only by the device core when all users of this gio device are * done. */ -void gio_release_dev(struct device *dev) +static void gio_release_dev(struct device *dev) { struct gio_device *giodev; giodev = to_gio_device(dev); kfree(giodev); } -EXPORT_SYMBOL_GPL(gio_release_dev); int gio_device_register(struct gio_device *giodev) { From e2f48710459487341a70b5c433b87046da861ac9 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Tue, 26 May 2026 18:40:32 +0200 Subject: [PATCH 24/41] MIPS: alchemy: platform: add missing include MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pull in the platform.h header into platform.c to fix the following warning: arch/mips/alchemy/devboards/platform.c:68:12: warning: no previous prototype for ‘db1x_register_pcmcia_socket’ [-Wmissing-prototypes] 68 | int __init db1x_register_pcmcia_socket(phys_addr_t pcmcia_attr_start, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/mips/alchemy/devboards/platform.c:152:12: warning: no previous prototype for ‘db1x_register_norflash’ [-Wmissing-prototypes] 152 | int __init db1x_register_norflash(unsigned long size, int width, | ^~~~~~~~~~~~~~~~~~~~~~ Tested-by: Manuel Lauss Signed-off-by: Bartosz Golaszewski Signed-off-by: Thomas Bogendoerfer --- arch/mips/alchemy/devboards/platform.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c index 46262c823fcb..fbc93d729c50 100644 --- a/arch/mips/alchemy/devboards/platform.c +++ b/arch/mips/alchemy/devboards/platform.c @@ -20,6 +20,8 @@ #include +#include "platform.h" + void prom_putchar(char c) { if (alchemy_get_cputype() == ALCHEMY_CPU_AU1300) From d9a316fd994ee3c43ea1dedf76d9f452da79fc2c Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Tue, 26 May 2026 18:40:33 +0200 Subject: [PATCH 25/41] MIPS: alchemy: provide visible function prototypes to board files Board files under arch/mips/alchemy/ define functions called from db1xxx.c but their prototypes are only in that .c file instead of being declared in a common header. This causes several build warnings about missing prototypes. Provide these prototypes in a new header and include it where necessary. Tested-by: Manuel Lauss Signed-off-by: Bartosz Golaszewski Signed-off-by: Thomas Bogendoerfer --- arch/mips/alchemy/devboards/db1000.c | 2 ++ arch/mips/alchemy/devboards/db1200.c | 1 + arch/mips/alchemy/devboards/db1300.c | 1 + arch/mips/alchemy/devboards/db1550.c | 2 ++ arch/mips/alchemy/devboards/db1xxx.c | 11 +---------- arch/mips/alchemy/devboards/db1xxx.h | 18 ++++++++++++++++++ 6 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 arch/mips/alchemy/devboards/db1xxx.h diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c index 6984cd5169b5..65238f14f28d 100644 --- a/arch/mips/alchemy/devboards/db1000.c +++ b/arch/mips/alchemy/devboards/db1000.c @@ -27,6 +27,8 @@ #include #include #include + +#include "db1xxx.h" #include "platform.h" #define F_SWAPPED (bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT) diff --git a/arch/mips/alchemy/devboards/db1200.c b/arch/mips/alchemy/devboards/db1200.c index 67f067706af2..de2a9083ed9a 100644 --- a/arch/mips/alchemy/devboards/db1200.c +++ b/arch/mips/alchemy/devboards/db1200.c @@ -30,6 +30,7 @@ #include #include +#include "db1xxx.h" #include "platform.h" #define BCSR_INT_IDE 0x0001 diff --git a/arch/mips/alchemy/devboards/db1300.c b/arch/mips/alchemy/devboards/db1300.c index d377e043b49f..b46f5e47da2c 100644 --- a/arch/mips/alchemy/devboards/db1300.c +++ b/arch/mips/alchemy/devboards/db1300.c @@ -32,6 +32,7 @@ #include #include +#include "db1xxx.h" #include "platform.h" /* FPGA (external mux) interrupt sources */ diff --git a/arch/mips/alchemy/devboards/db1550.c b/arch/mips/alchemy/devboards/db1550.c index 6c6837181f55..b8295a5c2e9a 100644 --- a/arch/mips/alchemy/devboards/db1550.c +++ b/arch/mips/alchemy/devboards/db1550.c @@ -28,6 +28,8 @@ #include #include #include + +#include "db1xxx.h" #include "platform.h" static void __init db1550_hw_setup(void) diff --git a/arch/mips/alchemy/devboards/db1xxx.c b/arch/mips/alchemy/devboards/db1xxx.c index e6d25aad8350..2e8c68d97b34 100644 --- a/arch/mips/alchemy/devboards/db1xxx.c +++ b/arch/mips/alchemy/devboards/db1xxx.c @@ -7,16 +7,7 @@ #include #include -int __init db1000_board_setup(void); -int __init db1000_dev_setup(void); -int __init db1500_pci_setup(void); -int __init db1200_board_setup(void); -int __init db1200_dev_setup(void); -int __init db1300_board_setup(void); -int __init db1300_dev_setup(void); -int __init db1550_board_setup(void); -int __init db1550_dev_setup(void); -int __init db1550_pci_setup(int); +#include "db1xxx.h" static const char *board_type_str(void) { diff --git a/arch/mips/alchemy/devboards/db1xxx.h b/arch/mips/alchemy/devboards/db1xxx.h new file mode 100644 index 000000000000..f39e3551e3b3 --- /dev/null +++ b/arch/mips/alchemy/devboards/db1xxx.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __LINUX_MIPS_DB1XXX__ +#define __LINUX_MIPS_DB1XXX__ + +const char *get_system_type(void); +int db1000_board_setup(void); +int db1000_dev_setup(void); +int db1500_pci_setup(void); +int db1200_board_setup(void); +int db1200_dev_setup(void); +int db1300_board_setup(void); +int db1300_dev_setup(void); +int db1550_board_setup(void); +int db1550_dev_setup(void); +int db1550_pci_setup(int id); + +#endif /* __LINUX_MIPS_DB1XXX__ */ From 054f568e0515fef01e3ee71728763aff7eb4623b Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 26 May 2026 18:40:34 +0200 Subject: [PATCH 26/41] MIPS: alchemy: mtx1: attach software nodes to GPIO chips GPIO subsystem is switching the way it locates GPIO chip instances for GPIO references in software nodes from matching on node names to identity matching, which necessitates assigning firmware nodes (software nodes) to GPIO chips. Move the node definitions for alchemy-gpio1 and alchemy-gpio2 to arch/misp/alchemy/common/gpiolib.c, register them there, and attach them to gpio_chip instances. Adjust MTX1 board file to use these nodes. Note that because nodes need to be registered before they can be used in PROPERTY_ENTRY_GPIO() we have to do the registration at postcore_initcall level, otherwise (due to the link order) MTX1 board initialization code will run first. Signed-off-by: Dmitry Torokhov [Bartosz: use platform_device_info::swnode] Tested-by: Manuel Lauss Signed-off-by: Bartosz Golaszewski Signed-off-by: Thomas Bogendoerfer --- arch/mips/alchemy/board-mtx1.c | 34 +++++++--------- arch/mips/alchemy/common/gpiolib.c | 39 ++++++++++++++++++- .../include/asm/mach-au1x00/gpio-au1000.h | 5 +++ 3 files changed, 56 insertions(+), 22 deletions(-) diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c index cb6be58808a0..88c20c0ca96d 100644 --- a/arch/mips/alchemy/board-mtx1.c +++ b/arch/mips/alchemy/board-mtx1.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -78,17 +79,13 @@ void __init board_setup(void) /******************************************************************************/ -static const struct software_node mtx1_gpiochip_node = { - .name = "alchemy-gpio2", -}; - static const struct software_node mtx1_gpio_keys_node = { .name = "mtx1-gpio-keys", }; static const struct property_entry mtx1_button_props[] = { PROPERTY_ENTRY_U32("linux,code", BTN_0), - PROPERTY_ENTRY_GPIO("gpios", &mtx1_gpiochip_node, 7, GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpio2_node, 7, GPIO_ACTIVE_HIGH), PROPERTY_ENTRY_STRING("label", "System button"), { } }; @@ -98,7 +95,7 @@ static const struct software_node mtx1_button_node = { .properties = mtx1_button_props, }; -static const struct software_node *mtx1_gpio_keys_swnodes[] __initconst = { +static const struct software_node * const mtx1_gpio_keys_swnodes[] __initconst = { &mtx1_gpio_keys_node, &mtx1_button_node, NULL @@ -127,13 +124,13 @@ static void __init mtx1_keys_init(void) pr_err("failed to create gpio-keys device: %d\n", err); } -/* Global number 215 is offset 15 on Alchemy GPIO 2 */ static const struct property_entry mtx1_wdt_props[] = { - PROPERTY_ENTRY_GPIO("gpios", &mtx1_gpiochip_node, 15, GPIO_ACTIVE_HIGH), + /* Global number 215 is offset 15 on Alchemy GPIO 2 */ + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpio2_node, 15, GPIO_ACTIVE_HIGH), { } }; -static struct platform_device_info mtx1_wdt_info __initconst = { +static const struct platform_device_info mtx1_wdt_info __initconst = { .name = "mtx1-wdt", .id = 0, .properties = mtx1_wdt_props, @@ -147,7 +144,7 @@ static void __init mtx1_wdt_init(void) pd = platform_device_register_full(&mtx1_wdt_info); err = PTR_ERR_OR_ZERO(pd); if (err) - pr_err("failed to create gpio-keys device: %d\n", err); + pr_err("failed to create watchdog device: %d\n", err); } static const struct software_node mtx1_gpio_leds_node = { @@ -155,7 +152,7 @@ static const struct software_node mtx1_gpio_leds_node = { }; static const struct property_entry mtx1_green_led_props[] = { - PROPERTY_ENTRY_GPIO("gpios", &mtx1_gpiochip_node, 11, GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpio2_node, 11, GPIO_ACTIVE_HIGH), { } }; @@ -166,7 +163,7 @@ static const struct software_node mtx1_green_led_node = { }; static const struct property_entry mtx1_red_led_props[] = { - PROPERTY_ENTRY_GPIO("gpios", &mtx1_gpiochip_node, 12, GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpio2_node, 12, GPIO_ACTIVE_HIGH), { } }; @@ -176,7 +173,7 @@ static const struct software_node mtx1_red_led_node = { .properties = mtx1_red_led_props, }; -static const struct software_node *mtx1_gpio_leds_swnodes[] = { +static const struct software_node * const mtx1_gpio_leds_swnodes[] __initconst = { &mtx1_gpio_leds_node, &mtx1_green_led_node, &mtx1_red_led_node, @@ -185,9 +182,10 @@ static const struct software_node *mtx1_gpio_leds_swnodes[] = { static void __init mtx1_leds_init(void) { - struct platform_device_info led_info = { + const struct platform_device_info pdevinfo = { .name = "leds-gpio", .id = PLATFORM_DEVID_NONE, + .swnode = &mtx1_gpio_leds_node, }; struct platform_device *led_dev; int err; @@ -198,9 +196,7 @@ static void __init mtx1_leds_init(void) return; } - led_info.fwnode = software_node_fwnode(&mtx1_gpio_leds_node); - - led_dev = platform_device_register_full(&led_info); + led_dev = platform_device_register_full(&pdevinfo); err = PTR_ERR_OR_ZERO(led_dev); if (err) pr_err("failed to create LED device: %d\n", err); @@ -335,10 +331,6 @@ static int __init mtx1_register_devices(void) au1xxx_override_eth_cfg(0, &mtx1_au1000_eth0_pdata); - rc = software_node_register(&mtx1_gpiochip_node); - if (rc) - return rc; - rc = platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs)); if (rc) return rc; diff --git a/arch/mips/alchemy/common/gpiolib.c b/arch/mips/alchemy/common/gpiolib.c index e79e26ffac99..2141eae5ce45 100644 --- a/arch/mips/alchemy/common/gpiolib.c +++ b/arch/mips/alchemy/common/gpiolib.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -95,7 +96,21 @@ static int gpio1_to_irq(struct gpio_chip *chip, unsigned offset) return alchemy_gpio1_to_irq(offset + ALCHEMY_GPIO1_BASE); } -struct gpio_chip alchemy_gpio_chip[] = { +const struct software_node alchemy_gpio1_node = { + .name = "alchemy-gpio1", +}; + +const struct software_node alchemy_gpio2_node = { + .name = "alchemy-gpio2", +}; + +static const struct software_node *alchemy_gpio_node_group[] = { + &alchemy_gpio1_node, + &alchemy_gpio2_node, + NULL +}; + +static struct gpio_chip alchemy_gpio_chip[] = { [0] = { .label = "alchemy-gpio1", .direction_input = gpio1_direction_input, @@ -157,6 +172,28 @@ static struct gpio_chip au1300_gpiochip = { .ngpio = AU1300_GPIO_NUM, }; +/* + * Software nodes must be registered before board-specific code (that runs + * at arch_initcall level) attempts to use them as GPIO targets or as fwnodes + * for registered devices. We can not do registration in alchemy_gpiochip_init + * because it also runs as arch_initcall and runs after board-specific code + * because of the link order, and so we do it at postcore_initcall level. + */ +static int __init alchemy_gpio_nodes_init(void) +{ + int ret; + + ret = software_node_register_node_group(alchemy_gpio_node_group); + if (ret) + return ret; + + alchemy_gpio_chip[0].fwnode = software_node_fwnode(&alchemy_gpio1_node); + alchemy_gpio_chip[1].fwnode = software_node_fwnode(&alchemy_gpio2_node); + + return 0; +} +postcore_initcall(alchemy_gpio_nodes_init); + static int __init alchemy_gpiochip_init(void) { int ret = 0; diff --git a/arch/mips/include/asm/mach-au1x00/gpio-au1000.h b/arch/mips/include/asm/mach-au1x00/gpio-au1000.h index e6306f6820e6..de7f857cb333 100644 --- a/arch/mips/include/asm/mach-au1x00/gpio-au1000.h +++ b/arch/mips/include/asm/mach-au1x00/gpio-au1000.h @@ -40,6 +40,11 @@ #define AU1000_GPIO2_INTENABLE 0x10 #define AU1000_GPIO2_ENABLE 0x14 +struct software_node; + +extern const struct software_node alchemy_gpio1_node; +extern const struct software_node alchemy_gpio2_node; + static inline int au1000_gpio1_to_irq(int gpio) { return MAKE_IRQ(1, gpio - ALCHEMY_GPIO1_BASE); From dc26a10ef98f3dabd9dd9420c5d615891d3321cd Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 26 May 2026 18:40:35 +0200 Subject: [PATCH 27/41] MIPS: alchemy: db1000: use nodes attached to GPIO chips in properties GPIO subsystem is switching the way it locates GPIO chip instances for GPIO references in software nodes by doing identity matching instead of matching on node names. Switch to using software nodes attached to gpio chips instead of using freestanding software nodes. Also stop supplying platform data for the spi-gpio controller since spi-gpio driver can derive number of chipselect lines from device properties. Signed-off-by: Dmitry Torokhov Tested-by: Manuel Lauss Signed-off-by: Bartosz Golaszewski Signed-off-by: Thomas Bogendoerfer --- arch/mips/alchemy/devboards/db1000.c | 29 ++++++++-------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c index 65238f14f28d..8fb24b220e3a 100644 --- a/arch/mips/alchemy/devboards/db1000.c +++ b/arch/mips/alchemy/devboards/db1000.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -377,20 +376,15 @@ static struct platform_device db1100_mmc1_dev = { /******************************************************************************/ -static const struct software_node db1100_alchemy2_gpiochip = { - .name = "alchemy-gpio2", -}; - -static const struct property_entry db1100_ads7846_properties[] = { +static const struct property_entry db1100_ads7846_props[] = { PROPERTY_ENTRY_U16("ti,vref_min", 3300), - PROPERTY_ENTRY_GPIO("pendown-gpios", - &db1100_alchemy2_gpiochip, 21, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_GPIO("pendown-gpios", &alchemy_gpio2_node, 21, GPIO_ACTIVE_LOW), { } }; static const struct software_node db1100_ads7846_swnode = { .name = "ads7846", - .properties = db1100_ads7846_properties, + .properties = db1100_ads7846_props, }; static struct spi_board_info db1100_spi_info[] __initdata = { @@ -405,32 +399,26 @@ static struct spi_board_info db1100_spi_info[] __initdata = { }, }; -static const struct spi_gpio_platform_data db1100_spictl_pd __initconst = { - .num_chipselect = 1, -}; - /* * Alchemy GPIO 2 has its base at 200 so the GPIO lines * 207 thru 210 are GPIOs at offset 7 thru 10 at this chip. */ static const struct property_entry db1100_spi_dev_properties[] __initconst = { PROPERTY_ENTRY_GPIO("miso-gpios", - &db1100_alchemy2_gpiochip, 7, GPIO_ACTIVE_HIGH), + &alchemy_gpio2_node, 7, GPIO_ACTIVE_HIGH), PROPERTY_ENTRY_GPIO("mosi-gpios", - &db1100_alchemy2_gpiochip, 8, GPIO_ACTIVE_HIGH), + &alchemy_gpio2_node, 8, GPIO_ACTIVE_HIGH), PROPERTY_ENTRY_GPIO("sck-gpios", - &db1100_alchemy2_gpiochip, 9, GPIO_ACTIVE_HIGH), + &alchemy_gpio2_node, 9, GPIO_ACTIVE_HIGH), PROPERTY_ENTRY_GPIO("cs-gpios", - &db1100_alchemy2_gpiochip, 10, GPIO_ACTIVE_HIGH), + &alchemy_gpio2_node, 10, GPIO_ACTIVE_HIGH), { } }; static const struct platform_device_info db1100_spi_dev_info __initconst = { .name = "spi_gpio", .id = 0, - .data = &db1100_spictl_pd, - .size_data = sizeof(db1100_spictl_pd), - .dma_mask = DMA_BIT_MASK(32), + .dma_mask = DMA_BIT_MASK(32), .properties = db1100_spi_dev_properties, }; @@ -483,7 +471,6 @@ int __init db1000_dev_setup(void) pfc |= (1 << 0); /* SSI0 pins as GPIOs */ alchemy_wrsys(pfc, AU1000_SYS_PINFUNC); - software_node_register(&db1100_alchemy2_gpiochip); spi_register_board_info(db1100_spi_info, ARRAY_SIZE(db1100_spi_info)); From 28c4800dd5db722b27034fc192ba544e82217a14 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 26 May 2026 18:40:36 +0200 Subject: [PATCH 28/41] MIPS: alchemy: gpr: switch to static device properties Convert I2C-gpio device and GPIO-connected LEDs on GPR board to software nodes/properties, so that support for platform data can be removed from gpio-leds driver (which will rely purely on generic device properties for configuration). Signed-off-by: Dmitry Torokhov [Bartosz: use platform_device_info::swnode] Tested-by: Manuel Lauss Signed-off-by: Bartosz Golaszewski Signed-off-by: Thomas Bogendoerfer --- arch/mips/alchemy/board-gpr.c | 127 ++++++++++++++++++++-------------- 1 file changed, 75 insertions(+), 52 deletions(-) diff --git a/arch/mips/alchemy/board-gpr.c b/arch/mips/alchemy/board-gpr.c index f587c40b6d00..387252337a18 100644 --- a/arch/mips/alchemy/board-gpr.c +++ b/arch/mips/alchemy/board-gpr.c @@ -13,11 +13,11 @@ #include #include #include -#include -#include #include #include #include +#include +#include #include #include #include @@ -161,66 +161,90 @@ static struct platform_device gpr_mtd_device = { /* * LEDs */ -static const struct gpio_led gpr_gpio_leds[] = { - { /* green */ - .name = "gpr:green", - .gpio = 4, - .active_low = 1, - }, - { /* red */ - .name = "gpr:red", - .gpio = 5, - .active_low = 1, - } +static const struct software_node gpr_gpio_leds_node = { + .name = "gpr-leds", }; -static struct gpio_led_platform_data gpr_led_data = { - .num_leds = ARRAY_SIZE(gpr_gpio_leds), - .leds = gpr_gpio_leds, +static const struct property_entry gpr_green_led_props[] = { + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpio1_node, 4, GPIO_ACTIVE_LOW), + { } }; -static struct platform_device gpr_led_devices = { - .name = "leds-gpio", - .id = -1, - .dev = { - .platform_data = &gpr_led_data, - } +static const struct software_node gpr_green_led_node = { + .name = "gpr:green", + .parent = &gpr_gpio_leds_node, + .properties = gpr_green_led_props, }; +static const struct property_entry gpr_red_led_props[] = { + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpio1_node, 5, GPIO_ACTIVE_LOW), + { } +}; + +static const struct software_node gpr_red_led_node = { + .name = "gpr:red", + .parent = &gpr_gpio_leds_node, + .properties = gpr_red_led_props, +}; + +static const struct software_node * const gpr_gpio_leds_swnodes[] __initconst = { + &gpr_gpio_leds_node, + &gpr_green_led_node, + &gpr_red_led_node, + NULL +}; + +static void __init gpr_leds_init(void) +{ + const struct platform_device_info pdevinfo = { + .name = "leds-gpio", + .id = PLATFORM_DEVID_NONE, + .swnode = &gpr_gpio_leds_node, + }; + struct platform_device *pd; + int err; + + err = software_node_register_node_group(gpr_gpio_leds_swnodes); + if (err) { + pr_err("failed to register LED software nodes: %d\n", err); + return; + } + + pd = platform_device_register_full(&pdevinfo); + err = PTR_ERR_OR_ZERO(pd); + if (err) + pr_err("failed to create LED device: %d\n", err); +} + /* * I2C */ -static struct gpiod_lookup_table gpr_i2c_gpiod_table = { - .dev_id = "i2c-gpio", - .table = { - /* - * This should be on "GPIO2" which has base at 200 so - * the global numbers 209 and 210 should correspond to - * local offsets 9 and 10. - */ - GPIO_LOOKUP_IDX("alchemy-gpio2", 9, NULL, 0, - GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("alchemy-gpio2", 10, NULL, 1, - GPIO_ACTIVE_HIGH), - }, +static const struct property_entry gpr_i2c_props[] __initconst = { + PROPERTY_ENTRY_GPIO("sda-gpios", &alchemy_gpio2_node, 9, GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("scl-gpios", &alchemy_gpio2_node, 10, GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_U32("i2c-gpio,delay-us", 2), /* ~100 kHz */ + PROPERTY_ENTRY_U32("i2c-gpio,timeout-ms", 1000), + PROPERTY_ENTRY_BOOL("i2c-gpio,sda-open-drain"), + PROPERTY_ENTRY_BOOL("i2c-gpio,scl-open-drain"), + { } }; -static struct i2c_gpio_platform_data gpr_i2c_data = { - /* - * The open drain mode is hardwired somewhere or an electrical - * property of the alchemy GPIO controller. - */ - .sda_is_open_drain = 1, - .scl_is_open_drain = 1, - .udelay = 2, /* ~100 kHz */ - .timeout = HZ, +static const struct platform_device_info gpr_i2c_pdev_info __initconst = { + .name = "i2c-gpio", + .id = PLATFORM_DEVID_NONE, + .properties = gpr_i2c_props, }; -static struct platform_device gpr_i2c_device = { - .name = "i2c-gpio", - .id = -1, - .dev.platform_data = &gpr_i2c_data, -}; +static void __init gpr_i2c_init(void) +{ + struct platform_device *pd; + int err; + + pd = platform_device_register_full(&gpr_i2c_pdev_info); + err = PTR_ERR_OR_ZERO(pd); + if (err) + pr_err("failed to create I2C device: %d\n", err); +} static struct i2c_board_info gpr_i2c_info[] __initdata = { { @@ -270,8 +294,6 @@ static struct platform_device gpr_pci_host_dev = { static struct platform_device *gpr_devices[] __initdata = { &gpr_wdt_device, &gpr_mtd_device, - &gpr_i2c_device, - &gpr_led_devices, }; static int __init gpr_pci_init(void) @@ -284,8 +306,9 @@ arch_initcall(gpr_pci_init); static int __init gpr_dev_init(void) { - gpiod_add_lookup_table(&gpr_i2c_gpiod_table); i2c_register_board_info(0, gpr_i2c_info, ARRAY_SIZE(gpr_i2c_info)); + gpr_i2c_init(); + gpr_leds_init(); return platform_add_devices(gpr_devices, ARRAY_SIZE(gpr_devices)); } From 6d96cc123ce33cd74e799c5434440393ed022bb7 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 26 May 2026 18:40:37 +0200 Subject: [PATCH 29/41] MIPS: alchemy: db1300: switch to static device properties Convert "5way switch" gpio-keys device and smsc911x ethernet controller to use static device properties instead of bespoke platform data structures for configuration. Signed-off-by: Dmitry Torokhov [Bartosz: use platform_device_info::swnode] Tested-by: Manuel Lauss Signed-off-by: Bartosz Golaszewski Signed-off-by: Thomas Bogendoerfer --- arch/mips/alchemy/common/gpiolib.c | 6 + arch/mips/alchemy/devboards/db1300.c | 218 ++++++++++++------ .../include/asm/mach-au1x00/gpio-au1300.h | 3 + 3 files changed, 156 insertions(+), 71 deletions(-) diff --git a/arch/mips/alchemy/common/gpiolib.c b/arch/mips/alchemy/common/gpiolib.c index 2141eae5ce45..c926cc137561 100644 --- a/arch/mips/alchemy/common/gpiolib.c +++ b/arch/mips/alchemy/common/gpiolib.c @@ -104,9 +104,14 @@ const struct software_node alchemy_gpio2_node = { .name = "alchemy-gpio2", }; +const struct software_node alchemy_gpic_node = { + .name = "alchemy-gpic", +}; + static const struct software_node *alchemy_gpio_node_group[] = { &alchemy_gpio1_node, &alchemy_gpio2_node, + &alchemy_gpic_node, NULL }; @@ -189,6 +194,7 @@ static int __init alchemy_gpio_nodes_init(void) alchemy_gpio_chip[0].fwnode = software_node_fwnode(&alchemy_gpio1_node); alchemy_gpio_chip[1].fwnode = software_node_fwnode(&alchemy_gpio2_node); + au1300_gpiochip.fwnode = software_node_fwnode(&alchemy_gpic_node); return 0; } diff --git a/arch/mips/alchemy/devboards/db1300.c b/arch/mips/alchemy/devboards/db1300.c index b46f5e47da2c..a7b8b7e8291f 100644 --- a/arch/mips/alchemy/devboards/db1300.c +++ b/arch/mips/alchemy/devboards/db1300.c @@ -7,10 +7,10 @@ #include #include -#include -#include +#include +#include #include -#include /* KEY_* codes */ +#include #include #include #include @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -237,23 +238,38 @@ static struct resource db1300_eth_res[] = { }, }; -static struct smsc911x_platform_config db1300_eth_config = { - .phy_interface = PHY_INTERFACE_MODE_MII, - .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, - .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, - .flags = SMSC911X_USE_32BIT, +static u8 db1300_eth_macaddr[6]; + +static const struct property_entry db1300_eth_props[] __initconst = { + PROPERTY_ENTRY_U32("reg-io-width", 4), + PROPERTY_ENTRY_U32("reg-shift", 0), + PROPERTY_ENTRY_BOOL("smsc,irq-push-pull"), + PROPERTY_ENTRY_STRING("phy-mode", "mii"), + PROPERTY_ENTRY_U8_ARRAY("local-mac-address", db1300_eth_macaddr), + { } }; -static struct platform_device db1300_eth_dev = { - .name = "smsc911x", - .id = -1, - .num_resources = ARRAY_SIZE(db1300_eth_res), - .resource = db1300_eth_res, - .dev = { - .platform_data = &db1300_eth_config, - }, +static const struct platform_device_info db1300_eth_info __initconst = { + .name = "smsc911x", + .id = PLATFORM_DEVID_NONE, + .res = db1300_eth_res, + .num_res = ARRAY_SIZE(db1300_eth_res), + .properties = db1300_eth_props, }; +static void __init db1300_eth_init(void) +{ + struct platform_device *pd; + int err; + + prom_get_ethernet_addr(db1300_eth_macaddr); + + pd = platform_device_register_full(&db1300_eth_info); + err = PTR_ERR_OR_ZERO(pd); + if (err) + pr_err("failed to create eth device: %d\n", err); +} + /**********************************************************************/ static struct resource au1300_psc1_res[] = { @@ -352,67 +368,128 @@ static struct platform_device db1300_i2c_dev = { /**********************************************************************/ +static const struct property_entry db1300_5waysw_props[] = { + PROPERTY_ENTRY_BOOL("autorepeat"), + PROPERTY_ENTRY_STRING("label", "db1300-5wayswitch"), + { } +}; + /* proper key assignments when facing the LCD panel. For key assignments * according to the schematics swap up with down and left with right. * I chose to use it to emulate the arrow keys of a keyboard. */ -static struct gpio_keys_button db1300_5waysw_arrowkeys[] = { - { - .code = KEY_DOWN, - .gpio = AU1300_PIN_LCDPWM0, - .type = EV_KEY, - .debounce_interval = 1, - .active_low = 1, - .desc = "5waysw-down", - }, - { - .code = KEY_UP, - .gpio = AU1300_PIN_PSC2SYNC1, - .type = EV_KEY, - .debounce_interval = 1, - .active_low = 1, - .desc = "5waysw-up", - }, - { - .code = KEY_RIGHT, - .gpio = AU1300_PIN_WAKE3, - .type = EV_KEY, - .debounce_interval = 1, - .active_low = 1, - .desc = "5waysw-right", - }, - { - .code = KEY_LEFT, - .gpio = AU1300_PIN_WAKE2, - .type = EV_KEY, - .debounce_interval = 1, - .active_low = 1, - .desc = "5waysw-left", - }, - { - .code = KEY_ENTER, - .gpio = AU1300_PIN_WAKE1, - .type = EV_KEY, - .debounce_interval = 1, - .active_low = 1, - .desc = "5waysw-push", - }, +static const struct software_node db1300_5waysw_node = { + .name = "db1300-5wayswitch", + .properties = db1300_5waysw_props, }; -static struct gpio_keys_platform_data db1300_5waysw_data = { - .buttons = db1300_5waysw_arrowkeys, - .nbuttons = ARRAY_SIZE(db1300_5waysw_arrowkeys), - .rep = 1, - .name = "db1300-5wayswitch", +static const struct property_entry db1300_5waysw_down_props[] = { + PROPERTY_ENTRY_U32("linux,code", KEY_DOWN), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpic_node, + AU1300_PIN_LCDPWM0, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_U32("debounce-interval", 1), + PROPERTY_ENTRY_STRING("label", "5waysw-down"), + { } }; -static struct platform_device db1300_5waysw_dev = { - .name = "gpio-keys", - .dev = { - .platform_data = &db1300_5waysw_data, - }, +static const struct software_node db1300_5waysw_down_node = { + .name = "5waysw-down", + .parent = &db1300_5waysw_node, + .properties = db1300_5waysw_down_props, }; +static const struct property_entry db1300_5waysw_up_props[] = { + PROPERTY_ENTRY_U32("linux,code", KEY_UP), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpic_node, + AU1300_PIN_PSC2SYNC1, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_U32("debounce-interval", 1), + PROPERTY_ENTRY_STRING("label", "5waysw-up"), + { } +}; + +static const struct software_node db1300_5waysw_up_node = { + .name = "5waysw-up", + .parent = &db1300_5waysw_node, + .properties = db1300_5waysw_up_props, +}; + +static const struct property_entry db1300_5waysw_right_props[] = { + PROPERTY_ENTRY_U32("linux,code", KEY_RIGHT), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpic_node, + AU1300_PIN_WAKE3, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_U32("debounce-interval", 1), + PROPERTY_ENTRY_STRING("label", "5waysw-right"), + { } +}; + +static const struct software_node db1300_5waysw_right_node = { + .name = "5waysw-right", + .parent = &db1300_5waysw_node, + .properties = db1300_5waysw_right_props, +}; + +static const struct property_entry db1300_5waysw_left_props[] = { + PROPERTY_ENTRY_U32("linux,code", KEY_LEFT), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpic_node, + AU1300_PIN_WAKE2, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_U32("debounce-interval", 1), + PROPERTY_ENTRY_STRING("label", "5waysw-left"), + { } +}; + +static const struct software_node db1300_5waysw_left_node = { + .name = "5waysw-left", + .parent = &db1300_5waysw_node, + .properties = db1300_5waysw_left_props, +}; + +static const struct property_entry db1300_5waysw_push_props[] = { + PROPERTY_ENTRY_U32("linux,code", KEY_ENTER), + PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpic_node, + AU1300_PIN_WAKE1, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_U32("debounce-interval", 1), + PROPERTY_ENTRY_STRING("label", "5waysw-push"), + { } +}; + +static const struct software_node db1300_5waysw_push_node = { + .name = "5waysw-push", + .parent = &db1300_5waysw_node, + .properties = db1300_5waysw_push_props, +}; + +static const struct software_node * const db1300_5waysw_swnodes[] __initconst = { + &db1300_5waysw_node, + &db1300_5waysw_down_node, + &db1300_5waysw_up_node, + &db1300_5waysw_right_node, + &db1300_5waysw_left_node, + &db1300_5waysw_push_node, + NULL +}; + +static void __init db1300_5waysw_init(void) +{ + const struct platform_device_info pdevinfo = { + .name = "gpio-keys", + .id = PLATFORM_DEVID_NONE, + .swnode = &db1300_5waysw_node, + }; + struct platform_device *pd; + int err; + + err = software_node_register_node_group(db1300_5waysw_swnodes); + if (err) { + pr_err("failed to register 5waysw software nodes: %d\n", err); + return; + } + + pd = platform_device_register_full(&pdevinfo); + err = PTR_ERR_OR_ZERO(pd); + if (err) + pr_err("failed to create 5waysw device: %d\n", err); +} + /**********************************************************************/ static struct pata_platform_info db1300_ide_info = { @@ -765,9 +842,7 @@ static struct platform_driver db1300_wm97xx_driver = { /**********************************************************************/ static struct platform_device *db1300_dev[] __initdata = { - &db1300_eth_dev, &db1300_i2c_dev, - &db1300_5waysw_dev, &db1300_nand_dev, &db1300_ide_dev, #ifdef CONFIG_MMC_AU1X @@ -805,8 +880,6 @@ int __init db1300_dev_setup(void) /* * setup board */ - prom_get_ethernet_addr(&db1300_eth_config.mac[0]); - i2c_register_board_info(0, db1300_i2c_devs, ARRAY_SIZE(db1300_i2c_devs)); @@ -849,6 +922,9 @@ int __init db1300_dev_setup(void) swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT; db1x_register_norflash(64 << 20, 2, swapped); + db1300_eth_init(); + db1300_5waysw_init(); + return platform_add_devices(db1300_dev, ARRAY_SIZE(db1300_dev)); } diff --git a/arch/mips/include/asm/mach-au1x00/gpio-au1300.h b/arch/mips/include/asm/mach-au1x00/gpio-au1300.h index b12f37262cfa..c92d3c2a5ef8 100644 --- a/arch/mips/include/asm/mach-au1x00/gpio-au1300.h +++ b/arch/mips/include/asm/mach-au1x00/gpio-au1300.h @@ -13,6 +13,9 @@ #include struct gpio_chip; +struct software_node; + +extern const struct software_node alchemy_gpic_node; /* with the current GPIC design, up to 128 GPIOs are possible. * The only implementation so far is in the Au1300, which has 75 externally From 4ff54ebe49244daaa0825fc6c7d126746b45a3de Mon Sep 17 00:00:00 2001 From: Ethan Nelson-Moore Date: Wed, 10 Jun 2026 15:01:22 -0700 Subject: [PATCH 30/41] MIPS: mm: remove comment referring to removed CONFIG_MIPS_CMP CMP support was removed in commit 7fb6f7b0af67 ("MIPS: Remove deprecated CONFIG_MIPS_CMP"), but a comment referring to it remained in arch/mips/mm/c-r4k.c. Remove it. Discovered while searching for CONFIG_* symbols referenced in code but not defined in any Kconfig file. Signed-off-by: Ethan Nelson-Moore Signed-off-by: Thomas Bogendoerfer --- arch/mips/mm/c-r4k.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 10413b6f6662..d8aadd3dc057 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c @@ -1757,11 +1757,6 @@ void r4k_cache_init(void) build_clear_page(); build_copy_page(); - /* - * We want to run CMP kernels on core with and without coherent - * caches. Therefore, do not use CONFIG_MIPS_CMP to decide whether - * or not to flush caches. - */ local_r4k___flush_cache_all(NULL); coherency_setup(); From 10fd82791fda5a52da0821eb6b50fbd09c8b3282 Mon Sep 17 00:00:00 2001 From: Catalin Iacob Date: Mon, 8 Jun 2026 17:29:17 +0300 Subject: [PATCH 31/41] mips: Remove remaining defconfig references to the pktcdvd driver Commit 1cea5180f2f8 ("block: remove pktcdvd driver") left behind some CONFIG_CONFIG_CDROM_PKTCDVD references in defconfigs. Remove them. Signed-off-by: Catalin Iacob Signed-off-by: Thomas Bogendoerfer --- arch/mips/configs/fuloong2e_defconfig | 1 - arch/mips/configs/ip22_defconfig | 1 - arch/mips/configs/ip27_defconfig | 1 - arch/mips/configs/ip30_defconfig | 1 - arch/mips/configs/jazz_defconfig | 1 - arch/mips/configs/malta_defconfig | 1 - arch/mips/configs/malta_kvm_defconfig | 1 - arch/mips/configs/maltaup_xpa_defconfig | 1 - arch/mips/configs/rm200_defconfig | 1 - arch/mips/configs/sb1250_swarm_defconfig | 1 - 10 files changed, 10 deletions(-) diff --git a/arch/mips/configs/fuloong2e_defconfig b/arch/mips/configs/fuloong2e_defconfig index b6fe3c962464..840130a73992 100644 --- a/arch/mips/configs/fuloong2e_defconfig +++ b/arch/mips/configs/fuloong2e_defconfig @@ -89,7 +89,6 @@ CONFIG_MTD_CFI_STAA=m CONFIG_MTD_PHYSMAP=m CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_RAM=m -CONFIG_CDROM_PKTCDVD=m CONFIG_ATA_OVER_ETH=m CONFIG_BLK_DEV_SD=y CONFIG_BLK_DEV_SR=y diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig index e123848f94ab..61f09cc9ac12 100644 --- a/arch/mips/configs/ip22_defconfig +++ b/arch/mips/configs/ip22_defconfig @@ -177,7 +177,6 @@ CONFIG_NET_ACT_SIMP=m CONFIG_NET_ACT_SKBEDIT=m CONFIG_RFKILL=m CONFIG_CONNECTOR=m -CONFIG_CDROM_PKTCDVD=m CONFIG_ATA_OVER_ETH=m CONFIG_RAID_ATTRS=m CONFIG_SCSI=y diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig index fea0ccee6948..60da9cf71b72 100644 --- a/arch/mips/configs/ip27_defconfig +++ b/arch/mips/configs/ip27_defconfig @@ -83,7 +83,6 @@ CONFIG_CFG80211=m CONFIG_MAC80211=m CONFIG_RFKILL=m CONFIG_BLK_DEV_LOOP=y -CONFIG_CDROM_PKTCDVD=m CONFIG_ATA_OVER_ETH=m CONFIG_SCSI=y CONFIG_BLK_DEV_SD=y diff --git a/arch/mips/configs/ip30_defconfig b/arch/mips/configs/ip30_defconfig index 718f3060d9fa..5c2911ff9a87 100644 --- a/arch/mips/configs/ip30_defconfig +++ b/arch/mips/configs/ip30_defconfig @@ -77,7 +77,6 @@ CONFIG_NET_ACT_PEDIT=m CONFIG_NET_ACT_SKBEDIT=m # CONFIG_VGA_ARB is not set CONFIG_BLK_DEV_LOOP=y -CONFIG_CDROM_PKTCDVD=m CONFIG_ATA_OVER_ETH=m CONFIG_SCSI=y CONFIG_BLK_DEV_SD=y diff --git a/arch/mips/configs/jazz_defconfig b/arch/mips/configs/jazz_defconfig index a790c2610fd3..dd3486b8d1fc 100644 --- a/arch/mips/configs/jazz_defconfig +++ b/arch/mips/configs/jazz_defconfig @@ -33,7 +33,6 @@ CONFIG_BLK_DEV_FD=m CONFIG_BLK_DEV_LOOP=m CONFIG_BLK_DEV_NBD=m CONFIG_BLK_DEV_RAM=m -CONFIG_CDROM_PKTCDVD=m CONFIG_ATA_OVER_ETH=m CONFIG_RAID_ATTRS=m CONFIG_SCSI=y diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig index 81704ec67f09..b10dac71f400 100644 --- a/arch/mips/configs/malta_defconfig +++ b/arch/mips/configs/malta_defconfig @@ -224,7 +224,6 @@ CONFIG_BLK_DEV_FD=m CONFIG_BLK_DEV_LOOP=m CONFIG_BLK_DEV_NBD=m CONFIG_BLK_DEV_RAM=y -CONFIG_CDROM_PKTCDVD=m CONFIG_ATA_OVER_ETH=m CONFIG_RAID_ATTRS=m CONFIG_BLK_DEV_SD=y diff --git a/arch/mips/configs/malta_kvm_defconfig b/arch/mips/configs/malta_kvm_defconfig index 82a97f58bce1..bdd5d99884e3 100644 --- a/arch/mips/configs/malta_kvm_defconfig +++ b/arch/mips/configs/malta_kvm_defconfig @@ -228,7 +228,6 @@ CONFIG_BLK_DEV_FD=m CONFIG_BLK_DEV_LOOP=m CONFIG_BLK_DEV_NBD=m CONFIG_BLK_DEV_RAM=y -CONFIG_CDROM_PKTCDVD=m CONFIG_ATA_OVER_ETH=m CONFIG_RAID_ATTRS=m CONFIG_BLK_DEV_SD=y diff --git a/arch/mips/configs/maltaup_xpa_defconfig b/arch/mips/configs/maltaup_xpa_defconfig index 0f9ef20744f9..523c0ff329ac 100644 --- a/arch/mips/configs/maltaup_xpa_defconfig +++ b/arch/mips/configs/maltaup_xpa_defconfig @@ -226,7 +226,6 @@ CONFIG_BLK_DEV_FD=m CONFIG_BLK_DEV_LOOP=m CONFIG_BLK_DEV_NBD=m CONFIG_BLK_DEV_RAM=y -CONFIG_CDROM_PKTCDVD=m CONFIG_ATA_OVER_ETH=m CONFIG_RAID_ATTRS=m CONFIG_BLK_DEV_SD=y diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig index ad9fbd0cbb38..60054e54bc5a 100644 --- a/arch/mips/configs/rm200_defconfig +++ b/arch/mips/configs/rm200_defconfig @@ -177,7 +177,6 @@ CONFIG_PARIDE_ON26=m CONFIG_BLK_DEV_LOOP=m CONFIG_BLK_DEV_NBD=m CONFIG_BLK_DEV_RAM=m -CONFIG_CDROM_PKTCDVD=m CONFIG_ATA_OVER_ETH=m CONFIG_RAID_ATTRS=m CONFIG_SCSI=y diff --git a/arch/mips/configs/sb1250_swarm_defconfig b/arch/mips/configs/sb1250_swarm_defconfig index 4a25b8d3e507..a50a7c097542 100644 --- a/arch/mips/configs/sb1250_swarm_defconfig +++ b/arch/mips/configs/sb1250_swarm_defconfig @@ -43,7 +43,6 @@ CONFIG_FW_LOADER=m CONFIG_CONNECTOR=m CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=9220 -CONFIG_CDROM_PKTCDVD=m CONFIG_ATA_OVER_ETH=m CONFIG_RAID_ATTRS=m CONFIG_BLK_DEV_SD=y From 5ae158d31d02ff0419e9e127659f71a85f36a70e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 7 Jun 2026 22:32:02 -0700 Subject: [PATCH 32/41] mips: dts: ar9132: fix wdt node name Fixes the following warning: $nodename:0: 'wdt@18060008' does not match '^(timer|watchdog)(@.*|-([0-9]|[1-9][0-9]+))?$' from schema $id: http://devicetree.org/schemas/watchdog/qca,ar7130-wdt.yaml# Signed-off-by: Rosen Penev Signed-off-by: Thomas Bogendoerfer --- arch/mips/boot/dts/qca/ar9132.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/boot/dts/qca/ar9132.dtsi b/arch/mips/boot/dts/qca/ar9132.dtsi index c1ca03a27b6c..b4a95b0b9b39 100644 --- a/arch/mips/boot/dts/qca/ar9132.dtsi +++ b/arch/mips/boot/dts/qca/ar9132.dtsi @@ -98,7 +98,7 @@ pll: pll-controller@18050000 { clock-output-names = "cpu", "ddr", "ahb"; }; - wdt: wdt@18060008 { + wdt: watchdog@18060008 { compatible = "qca,ar7130-wdt"; reg = <0x18060008 0x8>; From aeaa898780a4edb5802731e454caae6fb2ba33cb Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 27 May 2026 15:25:04 -0700 Subject: [PATCH 33/41] MIPS: ath79: reduce ARCH_DMA_MINALIGN Currently, ath79 SoCs use the default ARCH_DMA_MINALIGN value of 128 bytes defined in mach-generic. This is excessive for these platforms and leads to significant memory waste in kmalloc. Override ARCH_DMA_MINALIGN to use L1_CACHE_BYTES, which is 32 bytes for ath79 SoCs. Signed-off-by: Rosen Penev Signed-off-by: Thomas Bogendoerfer --- arch/mips/include/asm/mach-ath79/kmalloc.h | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 arch/mips/include/asm/mach-ath79/kmalloc.h diff --git a/arch/mips/include/asm/mach-ath79/kmalloc.h b/arch/mips/include/asm/mach-ath79/kmalloc.h new file mode 100644 index 000000000000..954f5d6e0dd0 --- /dev/null +++ b/arch/mips/include/asm/mach-ath79/kmalloc.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_MACH_ATH79_KMALLOC_H +#define __ASM_MACH_ATH79_KMALLOC_H + +#define ARCH_DMA_MINALIGN L1_CACHE_BYTES + +#endif /* __ASM_MACH_ATH79_KMALLOC_H */ From 1b001b16bc88f3f7817e228acfd91ee01bdcfcce Mon Sep 17 00:00:00 2001 From: Yadan Fan Date: Mon, 25 May 2026 12:04:36 +0800 Subject: [PATCH 34/41] MIPS: mm: Fix out-of-bounds write in maar_res_walk() maar_res_walk() uses wi->num_cfg as the index into the fixed-size wi->cfg array, but checks whether the array is full only after it has filled the selected entry. If walk_system_ram_range() reports more than 16 memory ranges, the overflow call writes one struct maar_config past the end of the array before WARN_ON() prevents num_cfg from advancing. Move the full-array check before taking the array slot and return non-zero when the scratch array is full, so walk_system_ram_range() terminates the walk instead of invoking the callback for further ranges. Fixes: a5718fe8f70f ("MIPS: mm: Drop boot_mem_map") Signed-off-by: Yadan Fan Signed-off-by: Thomas Bogendoerfer --- arch/mips/mm/init.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 55b25e85122a..1c07ca84ee21 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c @@ -272,9 +272,15 @@ static int maar_res_walk(unsigned long start_pfn, unsigned long nr_pages, void *data) { struct maar_walk_info *wi = data; - struct maar_config *cfg = &wi->cfg[wi->num_cfg]; + struct maar_config *cfg; unsigned int maar_align; + /* Ensure we don't overflow the cfg array */ + if (WARN_ON(wi->num_cfg >= ARRAY_SIZE(wi->cfg))) + return -1; + + cfg = &wi->cfg[wi->num_cfg]; + /* MAAR registers hold physical addresses right shifted by 4 bits */ maar_align = BIT(MIPS_MAAR_ADDR_SHIFT + 4); @@ -283,9 +289,7 @@ static int maar_res_walk(unsigned long start_pfn, unsigned long nr_pages, cfg->upper = ALIGN_DOWN(PFN_PHYS(start_pfn + nr_pages), maar_align) - 1; cfg->attrs = MIPS_MAAR_S; - /* Ensure we don't overflow the cfg array */ - if (!WARN_ON(wi->num_cfg >= ARRAY_SIZE(wi->cfg))) - wi->num_cfg++; + wi->num_cfg++; return 0; } From 98e37db4a34d3af3fb2f4648295c25b5e40b20e3 Mon Sep 17 00:00:00 2001 From: Aaron Tomlin Date: Tue, 26 May 2026 10:16:51 -0400 Subject: [PATCH 35/41] mips: sched: Fix CPUMASK_OFFSTACK memory corruption This patch addresses a critical memory management flaw. When CONFIG_CPUMASK_OFFSTACK is enabled, cpumask_var_t is a pointer. Consequently, sizeof(new_mask) evaluates to the pointer size, causing copy_from_user() to clobber the mask pointer. Furthermore, the old logic performed copy_from_user() before allocating the mask. Fix this by allocating new_mask first. To handle variable-sized user masks correctly, use cpumask_size() to truncate overly large user masks or pad undersized masks with zeros before copying the data directly into the allocated buffer. Fixes: 295cbf6d63165 ("[MIPS] Move FPU affinity code into separate file.") Cc: stable@vger.kernel.org Signed-off-by: Aaron Tomlin Signed-off-by: Thomas Bogendoerfer --- arch/mips/kernel/mips-mt-fpaff.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c index 10172fc4f627..4fead87d2f43 100644 --- a/arch/mips/kernel/mips-mt-fpaff.c +++ b/arch/mips/kernel/mips-mt-fpaff.c @@ -71,11 +71,16 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len, struct task_struct *p; int retval; - if (len < sizeof(new_mask)) - return -EINVAL; - - if (copy_from_user(&new_mask, user_mask_ptr, sizeof(new_mask))) - return -EFAULT; + if (!alloc_cpumask_var(&new_mask, GFP_KERNEL)) + return -ENOMEM; + if (len < cpumask_size()) + cpumask_clear(new_mask); + else if (len > cpumask_size()) + len = cpumask_size(); + if (copy_from_user(new_mask, user_mask_ptr, len)) { + retval = -EFAULT; + goto out_free_new_mask; + } cpus_read_lock(); rcu_read_lock(); @@ -84,7 +89,8 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len, if (!p) { rcu_read_unlock(); cpus_read_unlock(); - return -ESRCH; + retval = -ESRCH; + goto out_free_new_mask; } /* Prevent p going away */ @@ -95,13 +101,9 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len, retval = -ENOMEM; goto out_put_task; } - if (!alloc_cpumask_var(&new_mask, GFP_KERNEL)) { - retval = -ENOMEM; - goto out_free_cpus_allowed; - } if (!alloc_cpumask_var(&effective_mask, GFP_KERNEL)) { retval = -ENOMEM; - goto out_free_new_mask; + goto out_free_cpus_allowed; } if (!check_same_owner(p) && !capable(CAP_SYS_NICE)) { retval = -EPERM; @@ -142,13 +144,13 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len, } out_unlock: free_cpumask_var(effective_mask); -out_free_new_mask: - free_cpumask_var(new_mask); out_free_cpus_allowed: free_cpumask_var(cpus_allowed); out_put_task: put_task_struct(p); cpus_read_unlock(); +out_free_new_mask: + free_cpumask_var(new_mask); return retval; } From 8998c0904c72208fddc0b41565d6088a47b4720a Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 4 Jun 2026 19:12:11 +0200 Subject: [PATCH 36/41] MIPS: kernel: proc: Use seq_putc() calls in show_cpuinfo() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Single characters should occasionally be put into a sequence. Thus use the corresponding function “seq_putc”. The source code was transformed by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Thomas Bogendoerfer --- arch/mips/kernel/proc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c index 8f0a0001540c..261b41ef3f5a 100644 --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c @@ -79,7 +79,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) for (i = 0; i < cpu_data[n].watch_reg_count; i++) seq_printf(m, "%s0x%04x", i ? ", " : "", cpu_data[n].watch_reg_masks[i]); - seq_puts(m, "]"); + seq_putc(m, ']'); } seq_puts(m, "\nisa\t\t\t:"); @@ -150,7 +150,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) seq_puts(m, " loongson-ext"); if (cpu_has_loongson_ext2) seq_puts(m, " loongson-ext2"); - seq_puts(m, "\n"); + seq_putc(m, '\n'); if (cpu_has_mmips) { seq_printf(m, "micromips kernel\t: %s\n", @@ -301,7 +301,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) raw_notifier_call_chain(&proc_cpuinfo_chain, 0, &proc_cpuinfo_notifier_args); - seq_puts(m, "\n"); + seq_putc(m, '\n'); return 0; } From e1ac5f374253e65f0c8e0024a4828617b41e73fc Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 4 Jun 2026 19:15:15 +0200 Subject: [PATCH 37/41] MIPS: kernel: proc: Delete unnecessary braces in show_cpuinfo() Do not use curly brackets at one source code place where a single statement should be sufficient. Signed-off-by: Markus Elfring Signed-off-by: Thomas Bogendoerfer --- arch/mips/kernel/proc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c index 261b41ef3f5a..5401c679813a 100644 --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c @@ -152,10 +152,9 @@ static int show_cpuinfo(struct seq_file *m, void *v) seq_puts(m, " loongson-ext2"); seq_putc(m, '\n'); - if (cpu_has_mmips) { + if (cpu_has_mmips) seq_printf(m, "micromips kernel\t: %s\n", str_yes_no(read_c0_config3() & MIPS_CONF3_ISA_OE)); - } seq_puts(m, "Options implemented\t:"); if (cpu_has_tlb) From 9f3f3bdc6d9dac1a5a8262ee7ad0f2ff1527a7e7 Mon Sep 17 00:00:00 2001 From: Jonas Jelonek Date: Mon, 8 Jun 2026 09:37:29 +0000 Subject: [PATCH 38/41] MIPS: smp: report dying CPU to RCU in stop_this_cpu() smp_send_stop() parks all secondary CPUs in stop_this_cpu(). The function marks the CPU offline for the scheduler via set_cpu_online(false) but never informs RCU, so RCU keeps expecting a quiescent state from CPUs that are now spinning forever with interrupts disabled. As long as nothing waits for an RCU grace period after smp_send_stop() this is harmless, which is why it went unnoticed. Since commit 91840be8f710 ("irq_work: Fix use-after-free in irq_work_single() on PREEMPT_RT") however, irq_work_sync() calls synchronize_rcu() on architectures without an irq_work self-IPI, i.e. where arch_irq_work_has_interrupt() returns false. That is the asm-generic default used by MIPS. Any irq_work_sync() issued in the reboot/shutdown path after smp_send_stop() then blocks on a grace period that can never complete, hanging the reboot: WARNING: CPU: 0 PID: 15 at kernel/irq_work.c:144 irq_work_queue_on ... rcu: INFO: rcu_sched detected stalls on CPUs/tasks: rcu: Offline CPU 1 blocking current GP. rcu: Offline CPU 2 blocking current GP. rcu: Offline CPU 3 blocking current GP. This issue was noticed on several Realtek MIPS switch SoCs (MIPS interAptiv) and came up during kernel bump downstream in OpenWrt from 6.18.33 to 6.18.34, after the backport of the patch to the 6.18 stable branch. The patch also has been backported all the way back to 6.1. Call rcutree_report_cpu_dead() once interrupts are disabled, mirroring the generic CPU-hotplug offline path, so RCU stops waiting on the parked CPUs and grace periods can still complete. MIPS shuts down all CPUs here without going through the CPU-hotplug mechanism, so this report is not otherwise issued. Reporting a dying CPU to RCU outside the regular hotplug offline path is not unprecedented: arm64 does the same in cpu_die_early(). There it is an exception for a CPU that was coming online and is aborting bringup, rather than the default shutdown action as on MIPS. Fixes: 91840be8f710 ("irq_work: Fix use-after-free in irq_work_single() on PREEMPT_RT") CC: stable@vger.kernel.org Signed-off-by: Jonas Jelonek Signed-off-by: Thomas Bogendoerfer --- arch/mips/kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 4868e79f3b30..0f28b4a62e72 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -422,6 +423,7 @@ static void stop_this_cpu(void *dummy) set_cpu_online(smp_processor_id(), false); calculate_cpu_foreign_map(); local_irq_disable(); + rcutree_report_cpu_dead(); while (1); } From 315b21cf81780acf961a5bc9eaf979003c1bf8c4 Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Tue, 9 Jun 2026 18:31:21 -0700 Subject: [PATCH 39/41] MIPS: VDSO: Avoid including .got in dynamic segment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After commit 2db1ec80dfd5 ("MIPS: VDSO: Fold MIPS_DISABLE_VDSO into MIPS_GENERIC_GETTIMEOFDAY"), building ARCH=mips allnoconfig with LLVM=1 shows some warnings from llvm-readelf while checking the VDSO for dynamic relocations: llvm-readelf: warning: 'arch/mips/vdso/vdso.so.dbg.raw': invalid PT_DYNAMIC size (0xa4) llvm-readelf: warning: 'arch/mips/vdso/vdso.so.dbg.raw': PT_DYNAMIC dynamic table is invalid: SHT_DYNAMIC will be used The blamed commit alters the link order of objects into vdso.so.raw, placing vgettimeofday.o after sigreturn.o. This ultimately results in the .text section shrinking slightly in size, which in turn changes the offset of the .dynamic section. - [ 9] .text PROGBITS 000002f0 0002f0 000930 00 AX 0 0 16 - [10] .dynamic DYNAMIC 00000c20 000c20 000090 08 A 5 0 4 + [ 9] .text PROGBITS 000002f0 0002f0 000924 00 AX 0 0 16 + [10] .dynamic DYNAMIC 00000c14 000c14 000090 08 A 5 0 4 Changing the offset of the .dynamic section causes the dynamic segment size to grow by the same amount, which triggers a warning in llvm-readelf because PT_DYNAMIC's p_filesz (0xa4) is no longer a multiple of its sh_entsize (8): - DYNAMIC 0x000c20 0x00000c20 0x00000c20 0x00098 0x00098 R 0x10 + DYNAMIC 0x000c14 0x00000c14 0x00000c14 0x000a4 0x000a4 R 0x10 The size of the dynamic segment was already incorrect before the blamed comment, as it should be 0x90 like the .dynamic section above (18 entries at 8 bytes per entry); it just so happens that 0x98 % 8 is 0, whereas 0xa4 % 8 is 4, so there was no warning. Looking at the section to segment mapping of the dynamic segment reveals that it includes the .got section, as it is implicitly placed after .dynamic by ld.lld's orphan section heuristics and inherits its segments from the linker script. [ 9] .text PROGBITS 000002f0 0002f0 000924 00 AX 0 0 16 [10] .dynamic DYNAMIC 00000c14 000c14 000090 08 A 5 0 4 [11] .got PROGBITS 00000cb0 000cb0 000008 00 WAp 0 0 16 Section to Segment mapping: Segment Sections... 00 .mips_abiflags 01 .reginfo 02 .mips_abiflags .reginfo .hash .dynsym .dynstr .gnu.version .gnu.version_d .note .text .dynamic .got 03 .dynamic .got 04 .note Explicitly describe the .got section in the MIPS VDSO linker script after .rodata, which switches back to the default text segment, resulting in a dynamic segment that is the exact size of the .dynamic section as expected with no other layout changes. - DYNAMIC 0x000c14 0x00000c14 0x00000c14 0x000a4 0x000a4 R 0x10 + DYNAMIC 0x000c14 0x00000c14 0x00000c14 0x00090 0x00090 R 0x4 - 03 .dynamic .got + 03 .dynamic Closes: https://github.com/ClangBuiltLinux/linux/issues/2166 Fixes: 2db1ec80dfd5 ("MIPS: VDSO: Fold MIPS_DISABLE_VDSO into MIPS_GENERIC_GETTIMEOFDAY") Signed-off-by: Nathan Chancellor Reviewed-by: Thomas Weißschuh Acked-by: Nick Desaulniers Signed-off-by: Thomas Bogendoerfer --- arch/mips/vdso/vdso.lds.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S index 5d08be3a6b85..187361c7a867 100644 --- a/arch/mips/vdso/vdso.lds.S +++ b/arch/mips/vdso/vdso.lds.S @@ -56,6 +56,7 @@ SECTIONS .dynamic : { *(.dynamic) } :text :dynamic .rodata : { *(.rodata*) } :text + .got : { *(.got) } _end = .; PROVIDE(end = .); From 5dcd5846f1f9ee637613b285332e9bdb90757eb5 Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Mon, 8 Jun 2026 20:36:25 -0700 Subject: [PATCH 40/41] MIPS: lib: Remove '.hidden' for local symbols After a recent change in binutils that warns when local symbols have non-default visibility [1], there are a couple instances when building arch/mips: Assembler messages: {standard input}: Warning: local symbol `__memset' has non-default visibility Assembler messages: {standard input}: Warning: local symbol `__memcpy' has non-default visibility Remove the '.hidden' directives for these symbols to clear up the warnings, as they are pointless with a local symbol, which is by definition hidden. This results in no changes to these symbols in nm's output when assembled with various copies of binutils. Closes: https://lore.kernel.org/20260509122517.GA1108596@ax162/ Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c4150acbda1b3ce0602f79cbb7700b39e577be7e [1] Signed-off-by: Nathan Chancellor Signed-off-by: Thomas Bogendoerfer --- arch/mips/lib/memcpy.S | 2 -- arch/mips/lib/memset.S | 2 -- 2 files changed, 4 deletions(-) diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S index a4b4e805ff13..84f85aba6f4b 100644 --- a/arch/mips/lib/memcpy.S +++ b/arch/mips/lib/memcpy.S @@ -274,7 +274,6 @@ /* initialize __memcpy if this the first time we execute this macro */ .ifnotdef __memcpy .set __memcpy, 1 - .hidden __memcpy /* make sure it does not leak */ .endif /* @@ -538,7 +537,6 @@ .if __memcpy == 1 END(memcpy) .set __memcpy, 0 - .hidden __memcpy .endif .Ll_exc_copy\@: diff --git a/arch/mips/lib/memset.S b/arch/mips/lib/memset.S index 79405c32cc85..ab087406da66 100644 --- a/arch/mips/lib/memset.S +++ b/arch/mips/lib/memset.S @@ -89,7 +89,6 @@ /* Initialize __memset if this is the first time we call this macro */ .ifnotdef __memset .set __memset, 1 - .hidden __memset /* Make sure it does not leak */ .endif sltiu t0, a2, STORSIZE /* very small region? */ @@ -231,7 +230,6 @@ .if __memset == 1 END(memset) .set __memset, 0 - .hidden __memset .endif #ifdef CONFIG_CPU_NO_LOAD_STORE_LR From 6f25741b7565d7f82fc09947c981cae17535894d Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 28 Apr 2026 17:56:19 +0200 Subject: [PATCH 41/41] mips: select legacy gpiolib interfaces where used A few old machines have not been converted away from the old-style gpiolib interfaces. Make these select the new CONFIG_GPIOLIB_LEGACY symbol so the code still works where it is needed but can be left out otherwise. This is the list of all gpio_request() calls in mips: arch/mips/alchemy/devboards/db1000.c: gpio_request(19, "sd0_cd"); arch/mips/alchemy/devboards/db1000.c: gpio_request(20, "sd1_cd"); arch/mips/alchemy/devboards/db1200.c: gpio_request(215, "otg-vbus"); arch/mips/bcm47xx/workarounds.c: err = gpio_request_one(usb_power, GPIOF_OUT_INIT_HIGH, "usb_power"); arch/mips/bcm63xx/boards/board_bcm963xx.c: gpio_request_one(board.ephy_reset_gpio, arch/mips/txx9/rbtx4927/setup.c: gpio_request(15, "sio-dtr"); Most of these should be easy enough to change to modern gpio descriptors or remove if they are no longer in use. Signed-off-by: Arnd Bergmann Reviewed-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Signed-off-by: Thomas Bogendoerfer --- arch/mips/Kconfig | 5 +++++ arch/mips/alchemy/Kconfig | 1 - arch/mips/txx9/Kconfig | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 1cd8fc903387..2a568e384fd8 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -206,6 +206,8 @@ config MIPS_ALCHEMY select CSRC_R4K select IRQ_MIPS_CPU select DMA_NONCOHERENT # Au1000,1500,1100 aren't, rest is + select GPIOLIB + select GPIOLIB_LEGACY select MIPS_FIXUP_BIGPHYS_ADDR if PCI select SYS_HAS_CPU_MIPS32_R1 select SYS_SUPPORTS_32BIT_KERNEL @@ -307,6 +309,7 @@ config BCM47XX select SYS_HAS_EARLY_PRINTK select USE_GENERIC_EARLY_PRINTK_8250 select GPIOLIB + select GPIOLIB_LEGACY select LEDS_GPIO_REGISTER select BCM47XX_NVRAM select BCM47XX_SPROM @@ -330,6 +333,7 @@ config BCM63XX select SYS_HAS_CPU_BMIPS4380 select SWAP_IO_SPACE select GPIOLIB + select GPIOLIB_LEGACY select MIPS_L1_CACHE_SHIFT_4 select HAVE_LEGACY_CLK help @@ -999,6 +1003,7 @@ config MIKROTIK_RB532 select SWAP_IO_SPACE select BOOT_RAW select GPIOLIB + select GPIOLIB_LEGACY select MIPS_L1_CACHE_SHIFT_4 help Support the Mikrotik(tm) RouterBoard 532 series, diff --git a/arch/mips/alchemy/Kconfig b/arch/mips/alchemy/Kconfig index 6ca81e1bd35c..cf5ad52c0a0f 100644 --- a/arch/mips/alchemy/Kconfig +++ b/arch/mips/alchemy/Kconfig @@ -12,7 +12,6 @@ config MIPS_MTX1 config MIPS_DB1XXX bool "Alchemy DB1XXX / PB1XXX boards" - select GPIOLIB select HAVE_PCI select HAVE_PATA_PLATFORM select SYS_SUPPORTS_LITTLE_ENDIAN diff --git a/arch/mips/txx9/Kconfig b/arch/mips/txx9/Kconfig index 7335efa4d528..92b759a434c0 100644 --- a/arch/mips/txx9/Kconfig +++ b/arch/mips/txx9/Kconfig @@ -37,6 +37,7 @@ config SOC_TX4927 select IRQ_TXX9 select PCI_TX4927 select GPIO_TXX9 + select GPIOLIB_LEGACY config SOC_TX4938 bool