]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mips: fix PCI_IOBASE definition
authorArnd Bergmann <arnd@arndb.de>
Tue, 18 Mar 2025 21:15:35 +0000 (22:15 +0100)
committerArnd Bergmann <arnd@arndb.de>
Tue, 18 Mar 2025 21:42:42 +0000 (22:42 +0100)
After my previous patch, the ioport_map() function changed from
the lib/iomap.c version to the asm-generic/io.h version, which
requires a correct PCI_IOBASE definition.

Unfortunately the types are also different, so add the correct
definition for ioport_map() in asm/io.h and change the machine
specific ones to have the correct type.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
arch/mips/include/asm/io.h
arch/mips/include/asm/mach-loongson64/spaces.h
arch/mips/include/asm/mach-ralink/spaces.h
arch/mips/loongson64/init.c

index 1fe56d1870a688f3d68b638d74888ba2165b4717..78c6573f91f2caad660b11c6f78231a570706fb3 100644 (file)
@@ -544,12 +544,16 @@ extern void (*_dma_cache_inv)(unsigned long start, unsigned long size);
 
 void __ioread64_copy(void *to, const void __iomem *from, size_t count);
 
-#ifdef CONFIG_PCI_DRIVERS_LEGACY
+#if defined(CONFIG_PCI) && defined(CONFIG_PCI_DRIVERS_LEGACY)
 struct pci_dev;
 void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
 #define pci_iounmap pci_iounmap
 #endif
 
+#ifndef PCI_IOBASE
+#define PCI_IOBASE ((void __iomem *)mips_io_port_base)
+#endif
+
 #include <asm-generic/io.h>
 
 static inline void *isa_bus_to_virt(unsigned long address)
index ce04e998a37b32f7fe5c7f0e10807334eed0212e..dbd26db5f2c56f05111d5277da6fac3ec8d12031 100644 (file)
@@ -7,9 +7,10 @@
 #endif /* CONFIG_64BIT */
 
 /* Skip 128k to trap NULL pointer dereferences */
-#define PCI_IOBASE     _AC(0xc000000000000000 + SZ_128K, UL)
+#define PCI_PORT_BASE  _AC(0xc000000000000000 + SZ_128K, UL)
+#define PCI_IOBASE     (void __iomem *)PCI_PORT_BASE
 #define PCI_IOSIZE     SZ_16M
-#define MAP_BASE       (PCI_IOBASE + PCI_IOSIZE)
+#define MAP_BASE       (PCI_PORT_BASE + PCI_IOSIZE)
 
 #define IO_SPACE_LIMIT  (PCI_IOSIZE - 1)
 
index a9f0570d0f044ec972310e6654da7962d2fa8e8e..a63d106c89c6adf3639096232c66eb34e7ae87d3 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef __ASM_MACH_RALINK_SPACES_H_
 #define __ASM_MACH_RALINK_SPACES_H_
 
-#define PCI_IOBASE     mips_io_port_base
+#define PCI_IOBASE     (void __iomem *)mips_io_port_base
 #define PCI_IOSIZE     SZ_64K
 #define IO_SPACE_LIMIT (PCI_IOSIZE - 1)
 
index a35dd731179582f981de5517ee827295d6796173..b9f90f33fc9a6dde934a1e5880e83842e0811aa6 100644 (file)
@@ -128,7 +128,7 @@ void __init prom_init(void)
        }
 
        /* init base address of io space */
-       set_io_port_base(PCI_IOBASE);
+       set_io_port_base((unsigned long)PCI_IOBASE);
 
        if (loongson_sysconf.early_config)
                loongson_sysconf.early_config();
@@ -178,7 +178,7 @@ static int __init add_legacy_isa_io(struct fwnode_handle *fwnode, resource_size_
                return -EINVAL;
        }
 
-       vaddr = PCI_IOBASE + range->io_start;
+       vaddr = (unsigned long)PCI_IOBASE + range->io_start;
 
        vmap_page_range(vaddr, vaddr + size, hw_start, pgprot_device(PAGE_KERNEL));