]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
MIPS: Loongson2ef: Register PCI controller in early stage
authorRong Zhang <rongrong@oss.cipunited.com>
Sat, 31 Jan 2026 21:32:58 +0000 (05:32 +0800)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Thu, 5 Feb 2026 09:00:37 +0000 (10:00 +0100)
We are about to set loongson_pci_io_resource.start to 0 and adopt
PCIBIOS_MIN_IO. As the first step, PCI controller needs to be registered
in early stage to make it the root of other resources (e.g., i8259) and
prevent resource conflicts.

Register it in plat_mem_setup() instead of arch_initcall().

Fixes: ae81aad5c2e1 ("MIPS: PCI: Use pci_enable_resources()")
Cc: stable@vger.kernel.org
Tested-by: Beiyan Yun <root@infi.wang>
Tested-by: Yao Zi <me@ziyao.cc>
Signed-off-by: Rong Zhang <rongrong@oss.cipunited.com>
Acked-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/include/asm/mach-loongson2ef/loongson.h
arch/mips/loongson2ef/common/pci.c
arch/mips/loongson2ef/common/setup.c

index 4a098fb10232518be6e0c99d8bfa02977ca9d43d..0e586787eb87a7cbf4d1d63a5ca1e61c93990d43 100644 (file)
@@ -324,4 +324,10 @@ extern unsigned long _loongson_addrwincfg_base;
 
 #endif /* ! CONFIG_CPU_SUPPORTS_ADDRWINCFG */
 
+#ifdef CONFIG_PCI
+void loongson2ef_pcibios_init(void);
+#else
+static inline void loongson2ef_pcibios_init(void) { }
+#endif
+
 #endif /* __ASM_MACH_LOONGSON2EF_LOONGSON_H */
index 7d9ea51e8c01ec200bedfcc5a87036399b043022..55524f9a7b96b92267356e17700bff3816c5f66e 100644 (file)
@@ -73,15 +73,10 @@ static void __init setup_pcimap(void)
 #endif
 }
 
-static int __init pcibios_init(void)
+void __init loongson2ef_pcibios_init(void)
 {
        setup_pcimap();
 
        loongson_pci_controller.io_map_base = mips_io_port_base;
        register_pci_controller(&loongson_pci_controller);
-
-
-       return 0;
 }
-
-arch_initcall(pcibios_init);
index 4fd27f4f90edb625d5d6e8f73c8c082bef57a3c2..a639e35acce59b21cf75beabab3337cb9243fe66 100644 (file)
@@ -27,4 +27,5 @@ EXPORT_SYMBOL(__wbflush);
 
 void __init plat_mem_setup(void)
 {
+       loongson2ef_pcibios_init();
 }