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 <misha.zavertkin@mail.ru>
Fixes: 7cc31af7bd ("realtek: convert to generic machine initialization")
Signed-off-by: Rustam Adilov <adilov@tutamail.com>
Link: https://github.com/openwrt/openwrt/pull/24942
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
This commit is contained in:
Rustam Adilov authored and Markus Stockhausen committed 2026-08-31 16:37:28 +02:00
1 parent aa86f992b2
commit 347ea96b26
2 files changed
+14 -3

No files matched your search

@@ -334,16 +334,27 @@ Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
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_
}
@@ -28,4 +28,4 @@ Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
+ static unsigned char fdt_buf[32 << 10] __initdata;
int err;
realtek_prom_init(match_data);
/*