From 347ea96b26eeeb6f46da9b880f35caf292f643ca Mon Sep 17 00:00:00 2001 From: Rustam Adilov Date: Fri, 28 Aug 2026 21:50:55 +0500 Subject: [PATCH] realtek: fix PCI IO map panic with set_io_port_base(KSEG1) When the realtek target changed to generic mips initialization the set_io_port_base(KSEG1); from plat_mem_setup wasn't brought over to the realtek board file. This results in boot hang when trying to load PCIE driver on RTL9607C machine as it panics after devm_pci_alloc_host_bridge due to lack of mips_io_port_base definition. Fix it by adding set_io_port_base(KSEG1) to realtek_fixup_fdt. Generic MIPS calls fixup_fdt during plat_mem_setup so that roughly matches that of an old initialization from before. As this changes the board file, refresh the 300-03 patch to align with the new changes. Reported-by: Michael Zavertkin Fixes: 7cc31af7bdd4 ("realtek: convert to generic machine initialization") Signed-off-by: Rustam Adilov Link: https://github.com/openwrt/openwrt/pull/24942 Signed-off-by: Markus Stockhausen --- .../300-02-enhance-realtek-board-setup.patch | 15 +++++++++++++-- ...oard-increase-fixup_fdt-buffer-to-32-KiB.patch | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/target/linux/realtek/patches-6.18/300-02-enhance-realtek-board-setup.patch b/target/linux/realtek/patches-6.18/300-02-enhance-realtek-board-setup.patch index 54c1856d812..1f4f1982875 100644 --- a/target/linux/realtek/patches-6.18/300-02-enhance-realtek-board-setup.patch +++ b/target/linux/realtek/patches-6.18/300-02-enhance-realtek-board-setup.patch @@ -334,16 +334,27 @@ Signed-off-by: Markus Stockhausen static __init int realtek_add_initrd(void *fdt) { int node, err; -@@ -55,6 +361,8 @@ static __init const void *realtek_fixup_ +@@ -55,6 +361,19 @@ static __init const void *realtek_fixup_ static unsigned char fdt_buf[16 << 10] __initdata; int err; ++ /* ++ * The RTL9607C PCIe controller has 2 io regions, with the 2nd one ++ * being at an offset from the 1st one. This does not work with ++ * MIPS specific pci_remap_iospace() as it expects the region start ++ * address to be 0, which is not the case for 2nd io region of ++ * RTL9607C PCIe controller. Thus set the io port base to KSEG1, ++ * a common base for majority of MIPS platforms, for the generic ++ * pci_remap_iospace() to work here. ++ */ ++ set_io_port_base(KSEG1); ++ + realtek_prom_init(match_data); + if (fdt_check_header(fdt)) panic("Corrupt DT"); -@@ -68,12 +376,76 @@ static __init const void *realtek_fixup_ +@@ -68,12 +387,76 @@ static __init const void *realtek_fixup_ } diff --git a/target/linux/realtek/patches-6.18/300-03-realtek-board-increase-fixup_fdt-buffer-to-32-KiB.patch b/target/linux/realtek/patches-6.18/300-03-realtek-board-increase-fixup_fdt-buffer-to-32-KiB.patch index d5e93c3321b..2c9ef17d4a9 100644 --- a/target/linux/realtek/patches-6.18/300-03-realtek-board-increase-fixup_fdt-buffer-to-32-KiB.patch +++ b/target/linux/realtek/patches-6.18/300-03-realtek-board-increase-fixup_fdt-buffer-to-32-KiB.patch @@ -28,4 +28,4 @@ Signed-off-by: Jonas Jelonek + static unsigned char fdt_buf[32 << 10] __initdata; int err; - realtek_prom_init(match_data); + /*