15933f6d2SKuninori Morimoto // SPDX-License-Identifier: GPL-2.0 237b7a978SPaul Mundt /* 337b7a978SPaul Mundt * arch/sh/kernel/ioport.c 437b7a978SPaul Mundt * 537b7a978SPaul Mundt * Copyright (C) 2000 Niibe Yutaka 637b7a978SPaul Mundt * Copyright (C) 2005 - 2007 Paul Mundt 737b7a978SPaul Mundt */ 837b7a978SPaul Mundt #include <linux/module.h> 937b7a978SPaul Mundt #include <linux/io.h> 10*08732d12SChristoph Hellwig #include <asm/io_trapped.h> 1137b7a978SPaul Mundt 12666e81fdSAndi Kleen unsigned long sh_io_port_base __read_mostly = -1; 1337b7a978SPaul Mundt EXPORT_SYMBOL(sh_io_port_base); 1437b7a978SPaul Mundt __ioport_map(unsigned long addr,unsigned int size)1537b7a978SPaul Mundtvoid __iomem *__ioport_map(unsigned long addr, unsigned int size) 1637b7a978SPaul Mundt { 1737b7a978SPaul Mundt if (sh_mv.mv_ioport_map) 1837b7a978SPaul Mundt return sh_mv.mv_ioport_map(addr, size); 1937b7a978SPaul Mundt 2037b7a978SPaul Mundt return (void __iomem *)(addr + sh_io_port_base); 2137b7a978SPaul Mundt } 2237b7a978SPaul Mundt EXPORT_SYMBOL(__ioport_map); 2337b7a978SPaul Mundt ioport_map(unsigned long port,unsigned int nr)2437b7a978SPaul Mundtvoid __iomem *ioport_map(unsigned long port, unsigned int nr) 2537b7a978SPaul Mundt { 2637b7a978SPaul Mundt void __iomem *ret; 2737b7a978SPaul Mundt 2837b7a978SPaul Mundt ret = __ioport_map_trapped(port, nr); 2937b7a978SPaul Mundt if (ret) 3037b7a978SPaul Mundt return ret; 3137b7a978SPaul Mundt 3237b7a978SPaul Mundt return __ioport_map(port, nr); 3337b7a978SPaul Mundt } 3437b7a978SPaul Mundt EXPORT_SYMBOL(ioport_map); 3537b7a978SPaul Mundt ioport_unmap(void __iomem * addr)3637b7a978SPaul Mundtvoid ioport_unmap(void __iomem *addr) 3737b7a978SPaul Mundt { 3837b7a978SPaul Mundt if (sh_mv.mv_ioport_unmap) 3937b7a978SPaul Mundt sh_mv.mv_ioport_unmap(addr); 4037b7a978SPaul Mundt } 4137b7a978SPaul Mundt EXPORT_SYMBOL(ioport_unmap); 42