Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

unicore32: replace unicore32-specific iomap functions with generic lib implementation

1. define and enable CONFIG_GENERIC_IOMAP
2. define unicore32-specific PCI_IOBASE for asm-generic/io.h
3. define HAVE_ARCH_PIO_SIZE and unicore32-specific PIO_* macros
4. remove all unicore32-specific iomap functions

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Reviewed-and-Acked-by: Arnd Bergmann <arnd@arndb.de>

+10 -60
+3
arch/unicore32/Kconfig
··· 30 30 config GENERIC_CSUM 31 31 def_bool y 32 32 33 + config GENERIC_IOMAP 34 + def_bool y 35 + 33 36 config NO_IOPORT 34 37 bool 35 38
+6 -3
arch/unicore32/include/asm/io.h
··· 18 18 #include <asm/memory.h> 19 19 #include <asm/system.h> 20 20 21 + #define PCI_IOBASE io_p2v(PKUNITY_PCILIO_BASE) 21 22 #include <asm-generic/io.h> 22 23 23 24 /* ··· 39 38 #define ioremap_cached(cookie, size) __uc32_ioremap_cached(cookie, size) 40 39 #define iounmap(cookie) __uc32_iounmap(cookie) 41 40 42 - extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 43 - extern void ioport_unmap(void __iomem *addr); 44 - 45 41 /* 46 42 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 47 43 * access 48 44 */ 49 45 #undef xlate_dev_mem_ptr 50 46 #define xlate_dev_mem_ptr(p) __va(p) 47 + 48 + #define HAVE_ARCH_PIO_SIZE 49 + #define PIO_OFFSET (unsigned int)(PCI_IOBASE) 50 + #define PIO_MASK (unsigned int)(IO_SPACE_LIMIT) 51 + #define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1) 51 52 52 53 #endif /* __KERNEL__ */ 53 54 #endif /* __UNICORE_IO_H__ */
+1 -1
arch/unicore32/mm/Makefile
··· 3 3 # 4 4 5 5 obj-y := extable.o fault.o init.o pgd.o mmu.o 6 - obj-y += iomap.o flush.o ioremap.o 6 + obj-y += flush.o ioremap.o 7 7 8 8 obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o 9 9
-56
arch/unicore32/mm/iomap.c
··· 1 - /* 2 - * linux/arch/unicore32/mm/iomap.c 3 - * 4 - * Code specific to PKUnity SoC and UniCore ISA 5 - * 6 - * Copyright (C) 2001-2010 GUAN Xue-tao 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 - * 12 - * Map IO port and PCI memory spaces so that {read,write}[bwl] can 13 - * be used to access this memory. 14 - */ 15 - #include <linux/module.h> 16 - #include <linux/pci.h> 17 - #include <linux/ioport.h> 18 - #include <linux/io.h> 19 - 20 - #ifdef __io 21 - void __iomem *ioport_map(unsigned long port, unsigned int nr) 22 - { 23 - /* we map PC lagcy 64K IO port to PCI IO space 0x80030000 */ 24 - return (void __iomem *) (unsigned long) 25 - io_p2v((port & 0xffff) + PKUNITY_PCILIO_BASE); 26 - } 27 - EXPORT_SYMBOL(ioport_map); 28 - 29 - void ioport_unmap(void __iomem *addr) 30 - { 31 - } 32 - EXPORT_SYMBOL(ioport_unmap); 33 - #endif 34 - 35 - #ifdef CONFIG_PCI 36 - void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 37 - { 38 - resource_size_t start = pci_resource_start(dev, bar); 39 - resource_size_t len = pci_resource_len(dev, bar); 40 - unsigned long flags = pci_resource_flags(dev, bar); 41 - 42 - if (!len || !start) 43 - return NULL; 44 - if (maxlen && len > maxlen) 45 - len = maxlen; 46 - if (flags & IORESOURCE_IO) 47 - return ioport_map(start, len); 48 - if (flags & IORESOURCE_MEM) { 49 - if (flags & IORESOURCE_CACHEABLE) 50 - return ioremap(start, len); 51 - return ioremap_nocache(start, len); 52 - } 53 - return NULL; 54 - } 55 - EXPORT_SYMBOL(pci_iomap); 56 - #endif