sh: ioremap() overhaul.

ioremap() overhaul. Add support for transparent PMB mapping, get rid of
p3_ioremap(), etc. Also drop ioremap() and iounmap() routines from the
machvec, as everyone can use the generic ioremap() API instead. For PCI
memory apertures and other special cases, use the pci_iomap() API, as
boards are already required to get the mapping right there.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
diff --git a/arch/sh/boards/landisk/io.c b/arch/sh/boards/landisk/io.c
index 1f1679a..aa6b145 100644
--- a/arch/sh/boards/landisk/io.c
+++ b/arch/sh/boards/landisk/io.c
@@ -17,9 +17,9 @@
 
 #include <linux/kernel.h>
 #include <linux/types.h>
-#include <asm/io.h>
 #include <asm/landisk/iodata_landisk.h>
 #include <asm/addrspace.h>
+#include <asm/io.h>
 
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -42,10 +42,6 @@
 
 #define PCI_IOMAP(adr)	(PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK))
 
-#define maybebadio(name,port) \
-  printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \
-	 #name, (port), (__u32) __builtin_return_address(0))
-
 static inline void delay(void)
 {
 	ctrl_inw(0xa0000000);
@@ -66,7 +62,7 @@
 			return ((unsigned long)area6_io_base + PA_SIDE_OFFSET +
 				((port - 0x170) << 1));
 	else
-		maybebadio(port2adr, (unsigned long)port);
+		maybebadio((unsigned long)port);
 
 	return port;
 }
@@ -89,234 +85,200 @@
  * should be way beyond the window, and is used  w/o translation for
  * compatibility.
  */
-unsigned char landisk_inb(unsigned long port)
+u8 landisk_inb(unsigned long port)
 {
 	if (PXSEG(port))
-		return *(volatile unsigned char *)port;
+		return ctrl_inb(port);
 	else if (CHECK_SH7751_PCIIO(port))
-		return *(volatile unsigned char *)PCI_IOMAP(port);
-	else
-		return (*(volatile unsigned short *)port2adr(port) & 0xff);
+		return ctrl_inb(PCI_IOMAP(port));
+
+	return ctrl_inw(port2adr(port)) & 0xff;
 }
 
-unsigned char landisk_inb_p(unsigned long port)
+u8 landisk_inb_p(unsigned long port)
 {
-	unsigned char v;
+	u8 v;
 
 	if (PXSEG(port))
-		v = *(volatile unsigned char *)port;
+		v = ctrl_inb(port);
 	else if (CHECK_SH7751_PCIIO(port))
-		v = *(volatile unsigned char *)PCI_IOMAP(port);
+		v = ctrl_inb(PCI_IOMAP(port));
 	else
-		v = (*(volatile unsigned short *)port2adr(port) & 0xff);
+		v = ctrl_inw(port2adr(port)) & 0xff;
+
 	delay();
 
 	return v;
 }
 
-unsigned short landisk_inw(unsigned long port)
+u16 landisk_inw(unsigned long port)
 {
 	if (PXSEG(port))
-		return *(volatile unsigned short *)port;
+		return ctrl_inw(port);
 	else if (CHECK_SH7751_PCIIO(port))
-		return *(volatile unsigned short *)PCI_IOMAP(port);
+		return ctrl_inw(PCI_IOMAP(port));
 	else
-		maybebadio(inw, port);
+		maybebadio(port);
 
 	return 0;
 }
 
-unsigned int landisk_inl(unsigned long port)
+u32 landisk_inl(unsigned long port)
 {
 	if (PXSEG(port))
-		return *(volatile unsigned long *)port;
+		return ctrl_inl(port);
 	else if (CHECK_SH7751_PCIIO(port))
-		return *(volatile unsigned long *)PCI_IOMAP(port);
+		return ctrl_inl(PCI_IOMAP(port));
 	else
-		maybebadio(inl, port);
+		maybebadio(port);
 
 	return 0;
 }
 
-void landisk_outb(unsigned char value, unsigned long port)
+void landisk_outb(u8 value, unsigned long port)
 {
-
 	if (PXSEG(port))
-		*(volatile unsigned char *)port = value;
+		ctrl_outb(value, port);
 	else if (CHECK_SH7751_PCIIO(port))
-		*(volatile unsigned char *)PCI_IOMAP(port) = value;
+		ctrl_outb(value, PCI_IOMAP(port));
 	else
-		*(volatile unsigned short *)port2adr(port) = value;
+		ctrl_outw(value, port2adr(port));
 }
 
-void landisk_outb_p(unsigned char value, unsigned long port)
+void landisk_outb_p(u8 value, unsigned long port)
 {
 	if (PXSEG(port))
-		*(volatile unsigned char *)port = value;
+		ctrl_outb(value, port);
 	else if (CHECK_SH7751_PCIIO(port))
-		*(volatile unsigned char *)PCI_IOMAP(port) = value;
+		ctrl_outb(value, PCI_IOMAP(port));
 	else
-		*(volatile unsigned short *)port2adr(port) = value;
+		ctrl_outw(value, port2adr(port));
 	delay();
 }
 
-void landisk_outw(unsigned short value, unsigned long port)
+void landisk_outw(u16 value, unsigned long port)
 {
 	if (PXSEG(port))
-		*(volatile unsigned short *)port = value;
+		ctrl_outw(value, port);
 	else if (CHECK_SH7751_PCIIO(port))
-		*(volatile unsigned short *)PCI_IOMAP(port) = value;
+		ctrl_outw(value, PCI_IOMAP(port));
 	else
-		maybebadio(outw, port);
+		maybebadio(port);
 }
 
-void landisk_outl(unsigned int value, unsigned long port)
+void landisk_outl(u32 value, unsigned long port)
 {
 	if (PXSEG(port))
-		*(volatile unsigned long *)port = value;
+		ctrl_outl(value, port);
 	else if (CHECK_SH7751_PCIIO(port))
-		*(volatile unsigned long *)PCI_IOMAP(port) = value;
+		ctrl_outl(value, PCI_IOMAP(port));
 	else
-		maybebadio(outl, port);
+		maybebadio(port);
 }
 
-void landisk_insb(unsigned long port, void *addr, unsigned long count)
+void landisk_insb(unsigned long port, void *dst, unsigned long count)
 {
-	if (PXSEG(port))
-		while (count--)
-			*((unsigned char *)addr)++ =
-			    *(volatile unsigned char *)port;
-	else if (CHECK_SH7751_PCIIO(port)) {
-		volatile __u8 *bp = (__u8 *) PCI_IOMAP(port);
+        volatile u16 *p;
+        u8 *buf = dst;
 
-		while (count--)
-			*((volatile unsigned char *)addr)++ = *bp;
+        if (PXSEG(port)) {
+                while (count--)
+                        *buf++ = *(volatile u8 *)port;
+	} else if (CHECK_SH7751_PCIIO(port)) {
+                volatile u8 *bp = (volatile u8 *)PCI_IOMAP(port);
+
+                while (count--)
+                        *buf++ = *bp;
 	} else {
-		volatile __u16 *p = (volatile unsigned short *)port2adr(port);
-
-		while (count--)
-			*((unsigned char *)addr)++ = *p;
+                p = (volatile u16 *)port2adr(port);
+                while (count--)
+                        *buf++ = *p & 0xff;
 	}
 }
 
-void landisk_insw(unsigned long port, void *addr, unsigned long count)
+void landisk_insw(unsigned long port, void *dst, unsigned long count)
 {
-	volatile __u16 *p;
+        volatile u16 *p;
+        u16 *buf = dst;
 
 	if (PXSEG(port))
-		p = (volatile unsigned short *)port;
+		p = (volatile u16 *)port;
 	else if (CHECK_SH7751_PCIIO(port))
-		p = (volatile unsigned short *)PCI_IOMAP(port);
+		p = (volatile u16 *)PCI_IOMAP(port);
 	else
-		p = (volatile unsigned short *)port2adr(port);
+		p = (volatile u16 *)port2adr(port);
 	while (count--)
-		*((__u16 *) addr)++ = *p;
+		*buf++ = *p;
 }
 
-void landisk_insl(unsigned long port, void *addr, unsigned long count)
+void landisk_insl(unsigned long port, void *dst, unsigned long count)
 {
+        u32 *buf = dst;
+
 	if (CHECK_SH7751_PCIIO(port)) {
-		volatile __u32 *p = (__u32 *) PCI_IOMAP(port);
+                volatile u32 *p = (volatile u32 *)PCI_IOMAP(port);
 
-		while (count--)
-			*((__u32 *) addr)++ = *p;
+                while (count--)
+                        *buf++ = *p;
 	} else
-		maybebadio(insl, port);
+		maybebadio(port);
 }
 
-void landisk_outsb(unsigned long port, const void *addr, unsigned long count)
+void landisk_outsb(unsigned long port, const void *src, unsigned long count)
 {
+        volatile u16 *p;
+        const u8 *buf = src;
+
 	if (PXSEG(port))
-		while (count--)
-			*(volatile unsigned char *)port =
-			    *((unsigned char *)addr)++;
+                while (count--)
+                        ctrl_outb(*buf++, port);
 	else if (CHECK_SH7751_PCIIO(port)) {
-		volatile __u8 *bp = (__u8 *) PCI_IOMAP(port);
+                volatile u8 *bp = (volatile u8 *)PCI_IOMAP(port);
 
-		while (count--)
-			*bp = *((volatile unsigned char *)addr)++;
+                while (count--)
+                        *bp = *buf++;
 	} else {
-		volatile __u16 *p = (volatile unsigned short *)port2adr(port);
-
-		while (count--)
-			*p = *((unsigned char *)addr)++;
+                p = (volatile u16 *)port2adr(port);
+                while (count--)
+                        *p = *buf++;
 	}
 }
 
-void landisk_outsw(unsigned long port, const void *addr, unsigned long count)
+void landisk_outsw(unsigned long port, const void *src, unsigned long count)
 {
-	volatile __u16 *p;
+        volatile u16 *p;
+        const u16 *buf = src;
 
 	if (PXSEG(port))
-		p = (volatile unsigned short *)port;
+                p = (volatile u16 *)port;
 	else if (CHECK_SH7751_PCIIO(port))
-		p = (volatile unsigned short *)PCI_IOMAP(port);
+                p = (volatile u16 *)PCI_IOMAP(port);
 	else
-		p = (volatile unsigned short *)port2adr(port);
-	while (count--)
-		*p = *((__u16 *) addr)++;
+                p = (volatile u16 *)port2adr(port);
+
+        while (count--)
+                *p = *buf++;
 }
 
-void landisk_outsl(unsigned long port, const void *addr, unsigned long count)
+void landisk_outsl(unsigned long port, const void *src, unsigned long count)
 {
+        const u32 *buf = src;
+
 	if (CHECK_SH7751_PCIIO(port)) {
-		volatile __u32 *p = (__u32 *) PCI_IOMAP(port);
+                volatile u32 *p = (volatile u32 *)PCI_IOMAP(port);
 
-		while (count--)
-			*p = *((__u32 *) addr)++;
+                while (count--)
+                        *p = *buf++;
 	} else
-		maybebadio(outsl, port);
+		maybebadio(port);
 }
 
-/* For read/write calls, just copy generic (pass-thru); PCIMBR is  */
-/* already set up.  For a larger memory space, these would need to */
-/* reset PCIMBR as needed on a per-call basis...                   */
-
-unsigned char landisk_readb(unsigned long addr)
+void __iomem *landisk_ioport_map(unsigned long port, unsigned int size)
 {
-	return *(volatile unsigned char *)addr;
-}
+        if (PXSEG(port))
+                return (void __iomem *)port;
+        else if (CHECK_SH7751_PCIIO(port))
+                return (void __iomem *)PCI_IOMAP(port);
 
-unsigned short landisk_readw(unsigned long addr)
-{
-	return *(volatile unsigned short *)addr;
-}
-
-unsigned int landisk_readl(unsigned long addr)
-{
-	return *(volatile unsigned long *)addr;
-}
-
-void landisk_writeb(unsigned char b, unsigned long addr)
-{
-	*(volatile unsigned char *)addr = b;
-}
-
-void landisk_writew(unsigned short b, unsigned long addr)
-{
-	*(volatile unsigned short *)addr = b;
-}
-
-void landisk_writel(unsigned int b, unsigned long addr)
-{
-	*(volatile unsigned long *)addr = b;
-}
-
-void *landisk_ioremap(unsigned long offset, unsigned long size)
-{
-	if (offset >= 0xfd000000)
-		return (void *)offset;
-	else
-		return (void *)P2SEGADDR(offset);
-}
-
-void landisk_iounmap(void *addr)
-{
-}
-
-/* Map ISA bus address to the real address. Only for PCMCIA.  */
-
-unsigned long landisk_isa_port2addr(unsigned long offset)
-{
-	return port2adr(offset);
+        return (void __iomem *)port2adr(port);
 }
diff --git a/arch/sh/boards/landisk/setup.c b/arch/sh/boards/landisk/setup.c
index 0c60eaa..3a795cf 100644
--- a/arch/sh/boards/landisk/setup.c
+++ b/arch/sh/boards/landisk/setup.c
@@ -1,108 +1,151 @@
 /*
  * arch/sh/boards/landisk/setup.c
  *
+ * Copyright (C) 2000 Kazumoto Kojima
  * Copyright (C) 2002 Paul Mundt
  *
- * May be copied or modified under the terms of the GNU General Public
- * License.  See linux/COPYING for more information.
- *
- * Setup code for an unknown machine (internal peripherials only)
- */
-/*
- * linux/arch/sh/kernel/setup_landisk.c
- *
- * Copyright (C) 2000  Kazumoto Kojima
- *
  * I-O DATA Device, Inc. LANDISK Support.
  *
  * Modified for LANDISK by
  * Atom Create Engineering Co., Ltd. 2002.
- */
-/*
+ *
  * modifed by kogiidena
  * 2005.09.16
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
  */
-
 #include <linux/config.h>
 #include <linux/init.h>
-#include <linux/irq.h>
 #include <linux/pm.h>
-
-#include <linux/hdreg.h>
-#include <linux/ide.h>
-#include <linux/pci.h>
-
+#include <linux/mm.h>
 #include <asm/machvec.h>
 #include <asm/rtc.h>
-#include <asm/machvec_init.h>
-#include <asm/io.h>
 #include <asm/landisk/iodata_landisk.h>
-#include <asm/landisk/io.h>
+#include <asm/io.h>
 
-#include <linux/mm.h>
-#include <linux/vmalloc.h>
-
-extern void (*board_time_init) (void);
 void landisk_time_init(void);
-extern void init_landisk_IRQ(void);
+void init_landisk_IRQ(void);
 
 int landisk_ledparam;
 int landisk_buzzerparam;
 int landisk_arch;
 
-/* defined in mm/ioremap.c */
-extern void *p3_ioremap(unsigned long phys_addr, unsigned long size,
-			unsigned long flags);
+/* cycle the led's in the clasic knightrider/sun pattern */
+static void heartbeat_landisk(void)
+{
+	static unsigned int cnt = 0, blink = 0x00, period = 25;
+        volatile u8 *p = (volatile u8 *)PA_LED;
+	char data;
+
+        if ((landisk_ledparam & 0x080) == 0)
+		return;
+
+	cnt += 1;
+
+        if (cnt < period)
+		return;
+
+	cnt = 0;
+	blink++;
+
+	data = (blink & 0x01) ? (landisk_ledparam >> 16) : 0;
+	data |= (blink & 0x02) ? (landisk_ledparam >> 8) : 0;
+	data |= landisk_ledparam;
+
+	/* buzzer */
+	if (landisk_buzzerparam & 0x1) {
+		data |= 0x80;
+	} else {
+		data &= 0x7f;
+	}
+	*p = data;
+
+        if (((landisk_ledparam & 0x007f7f00) == 0) &&
+             (landisk_buzzerparam == 0))
+		landisk_ledparam &= (~0x0080);
+
+	landisk_buzzerparam >>= 1;
+}
 
 /*
- * Initialize the board
+ * The Machine Vector
  */
+struct sh_machine_vector mv_landisk __initmv = {
+	.mv_nr_irqs = 72,
+	.mv_inb = landisk_inb,
+	.mv_inw = landisk_inw,
+	.mv_inl = landisk_inl,
+	.mv_outb = landisk_outb,
+	.mv_outw = landisk_outw,
+	.mv_outl = landisk_outl,
+	.mv_inb_p = landisk_inb_p,
+	.mv_inw_p = landisk_inw,
+	.mv_inl_p = landisk_inl,
+	.mv_outb_p = landisk_outb_p,
+	.mv_outw_p = landisk_outw,
+	.mv_outl_p = landisk_outl,
+	.mv_insb = landisk_insb,
+	.mv_insw = landisk_insw,
+	.mv_insl = landisk_insl,
+	.mv_outsb = landisk_outsb,
+	.mv_outsw = landisk_outsw,
+	.mv_outsl = landisk_outsl,
+        .mv_ioport_map = landisk_ioport_map,
+	.mv_init_irq = init_landisk_IRQ,
+#ifdef CONFIG_HEARTBEAT
+	.mv_heartbeat = heartbeat_landisk,
+#endif
+};
+ALIAS_MV(landisk)
 
 const char *get_system_type(void)
 {
-	return "LANDISK";
+        return "LANDISK";
 }
 
 static void landisk_power_off(void)
 {
-	ctrl_outb(0x01, PA_SHUTDOWN);
+        ctrl_outb(0x01, PA_SHUTDOWN);
 }
 
-void check_usl5p(void)
+static void check_usl5p(void)
 {
-	volatile unsigned char *p = (volatile unsigned char *)PA_LED;
-	unsigned char tmp1, tmp2;
-	tmp1 = *p;
-	*p = 0x40;
-	tmp2 = *p;
-	*p = tmp1;
-	landisk_arch = (tmp2 == 0x40) ? 1 : 0;
-	if (landisk_arch == 1) {	/* arch == usl-5p */
-		landisk_ledparam = 0x00000380;
-		landisk_ledparam |= (tmp1 & 0x07c);
-	} else {                        /* arch == landisk */
-		landisk_ledparam = 0x02000180;
-		landisk_ledparam |= 0x04;
-	}
-	return;
+        volatile u8 *p = (volatile u8 *)PA_LED;
+        u8 tmp1, tmp2;
+
+        tmp1 = *p;
+        *p = 0x40;
+        tmp2 = *p;
+        *p = tmp1;
+
+        landisk_arch = (tmp2 == 0x40);
+        if (landisk_arch == 1) {
+                /* arch == usl-5p */
+                landisk_ledparam = 0x00000380;
+                landisk_ledparam |= (tmp1 & 0x07c);
+        } else {
+                /* arch == landisk */
+                landisk_ledparam = 0x02000180;
+                landisk_ledparam |= 0x04;
+        }
 }
 
 void __init platform_setup(void)
 {
+        landisk_buzzerparam = 0;
+        check_usl5p();
 
-	landisk_buzzerparam = 0;
-	check_usl5p();
-
-	printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
-	board_time_init = landisk_time_init;
-	pm_power_off = landisk_power_off;
-
+        printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
+        board_time_init = landisk_time_init;
+        pm_power_off = landisk_power_off;
 }
 
 void *area5_io_base;
 void *area6_io_base;
 
-int __init cf_init(void)
+static int __init landisk_cf_init(void)
 {
 	pgprot_t prot;
 	unsigned long paddrbase, psize;
@@ -133,86 +176,4 @@
 	return 0;
 }
 
-__initcall(cf_init);
-
-#include <linux/sched.h>
-
-/* Cycle the LED's in the clasic knightrider/Sun pattern */
-
-void heartbeat_landisk(void)
-{
-	static unsigned int cnt = 0, blink = 0x00, period = 25;
-	volatile unsigned char *p = (volatile unsigned char *)PA_LED;
-	char data;
-
-	if ((landisk_ledparam & 0x080) == 0) {
-		return;
-	}
-	cnt += 1;
-	if (cnt < period) {
-		return;
-	}
-	cnt = 0;
-	blink++;
-
-	data = (blink & 0x01) ? (landisk_ledparam >> 16) : 0;
-	data |= (blink & 0x02) ? (landisk_ledparam >> 8) : 0;
-	data |= landisk_ledparam;
-
-	/* buzzer */
-	if (landisk_buzzerparam & 0x1) {
-		data |= 0x80;
-	} else {
-		data &= 0x7f;
-	}
-	*p = data;
-
-	if (((landisk_ledparam & 0x007f7f00) == 0)
-	    && (landisk_buzzerparam == 0)) {
-		landisk_ledparam &= (~0x0080);
-	}
-	landisk_buzzerparam >>= 1;
-}
-
-/*
- * The Machine Vector
- */
-
-struct sh_machine_vector mv_landisk __initmv = {
-	.mv_nr_irqs = 72,
-	.mv_inb = landisk_inb,
-	.mv_inw = landisk_inw,
-	.mv_inl = landisk_inl,
-	.mv_outb = landisk_outb,
-	.mv_outw = landisk_outw,
-	.mv_outl = landisk_outl,
-	.mv_inb_p = landisk_inb_p,
-	.mv_inw_p = landisk_inw,
-	.mv_inl_p = landisk_inl,
-	.mv_outb_p = landisk_outb_p,
-	.mv_outw_p = landisk_outw,
-	.mv_outl_p = landisk_outl,
-	.mv_insb = landisk_insb,
-	.mv_insw = landisk_insw,
-	.mv_insl = landisk_insl,
-	.mv_outsb = landisk_outsb,
-	.mv_outsw = landisk_outsw,
-	.mv_outsl = landisk_outsl,
-	.mv_readb = landisk_readb,
-	.mv_readw = landisk_readw,
-	.mv_readl = landisk_readl,
-	.mv_writeb = landisk_writeb,
-	.mv_writew = landisk_writew,
-	.mv_writel = landisk_writel,
-	.mv_ioremap = landisk_ioremap,
-	.mv_iounmap = landisk_iounmap,
-	.mv_isa_port2addr = landisk_isa_port2addr,
-	.mv_init_irq = init_landisk_IRQ,
-
-#ifdef CONFIG_HEARTBEAT
-	.mv_heartbeat = heartbeat_landisk,
-#endif
-
-};
-
-ALIAS_MV(landisk)
+__initcall(landisk_cf_init);
diff --git a/arch/sh/boards/renesas/hs7751rvoip/io.c b/arch/sh/boards/renesas/hs7751rvoip/io.c
index 09fb77f..edecf10 100644
--- a/arch/sh/boards/renesas/hs7751rvoip/io.c
+++ b/arch/sh/boards/renesas/hs7751rvoip/io.c
@@ -294,15 +294,6 @@
 		maybebadio(outsl, port);
 }
 
-void *hs7751rvoip_ioremap(unsigned long offset, unsigned long size)
-{
-	if (offset >= 0xfd000000)
-		return (void *)offset;
-	else
-		return (void *)P2SEGADDR(offset);
-}
-EXPORT_SYMBOL(hs7751rvoip_ioremap);
-
 unsigned long hs7751rvoip_isa_port2addr(unsigned long offset)
 {
 	return port2adr(offset);
diff --git a/arch/sh/boards/renesas/hs7751rvoip/setup.c b/arch/sh/boards/renesas/hs7751rvoip/setup.c
index 813fc4d..aa51bda 100644
--- a/arch/sh/boards/renesas/hs7751rvoip/setup.c
+++ b/arch/sh/boards/renesas/hs7751rvoip/setup.c
@@ -60,7 +60,6 @@
 	.mv_outsw		= hs7751rvoip_outsw,
 	.mv_outsl		= hs7751rvoip_outsl,
 
-	.mv_ioremap		= hs7751rvoip_ioremap,
 	.mv_isa_port2addr	= hs7751rvoip_isa_port2addr,
 	.mv_init_irq		= hs7751rvoip_init_irq,
 };
diff --git a/arch/sh/boards/renesas/rts7751r2d/io.c b/arch/sh/boards/renesas/rts7751r2d/io.c
index 9e7fa72..8dc2a2e 100644
--- a/arch/sh/boards/renesas/rts7751r2d/io.c
+++ b/arch/sh/boards/renesas/rts7751r2d/io.c
@@ -321,15 +321,6 @@
 		maybebadio(port);
 }
 
-void *rts7751r2d_ioremap(unsigned long offset, unsigned long size)
-{
-	if (offset >= 0xfd000000)
-		return (void *)offset;
-	else
-		return (void *)P2SEGADDR(offset);
-}
-EXPORT_SYMBOL(rts7751r2d_ioremap);
-
 unsigned long rts7751r2d_isa_port2addr(unsigned long offset)
 {
 	return port2adr(offset);
diff --git a/arch/sh/boards/renesas/rts7751r2d/mach.c b/arch/sh/boards/renesas/rts7751r2d/mach.c
index 175a93d..fe3e873 100644
--- a/arch/sh/boards/renesas/rts7751r2d/mach.c
+++ b/arch/sh/boards/renesas/rts7751r2d/mach.c
@@ -19,7 +19,6 @@
 
 extern void heartbeat_rts7751r2d(void);
 extern void init_rts7751r2d_IRQ(void);
-extern void *rts7751r2d_ioremap(unsigned long, unsigned long);
 extern int rts7751r2d_irq_demux(int irq);
 
 extern void *voyagergx_consistent_alloc(struct device *, size_t, dma_addr_t *, gfp_t);
@@ -53,7 +52,6 @@
 	.mv_outsw		= rts7751r2d_outsw,
 	.mv_outsl		= rts7751r2d_outsl,
 
-	.mv_ioremap		= rts7751r2d_ioremap,
 	.mv_init_irq		= init_rts7751r2d_IRQ,
 #ifdef CONFIG_HEARTBEAT
 	.mv_heartbeat		= heartbeat_rts7751r2d,
diff --git a/arch/sh/boards/titan/io.c b/arch/sh/boards/titan/io.c
index d66900c..b886fd2 100644
--- a/arch/sh/boards/titan/io.c
+++ b/arch/sh/boards/titan/io.c
@@ -138,19 +138,12 @@
         maybebadio(port);
 }
 
-void *titan_ioremap(unsigned long offset, unsigned long size) {
-	if (CHECK_SH7751_PCIIO(offset) || CHECK_SH7751_PCIMEMIO(offset))
-		return (void *)offset;
-}
-
 void __iomem *titan_ioport_map(unsigned long port, unsigned int size)
 {
-	if (PXSEG(port))
+	if (PXSEG(port) || CHECK_SH7751_PCIMEMIO(port))
 		return (void __iomem *)port;
 	else if (CHECK_SH7751_PCIIO(port))
 		return (void __iomem *)PCI_IOMAP(port);
 
 	return (void __iomem *)port2adr(port);
 }
-
-EXPORT_SYMBOL(titan_ioremap);
diff --git a/arch/sh/boards/titan/setup.c b/arch/sh/boards/titan/setup.c
index 6ac5c8d7..c8b431c 100644
--- a/arch/sh/boards/titan/setup.c
+++ b/arch/sh/boards/titan/setup.c
@@ -51,7 +51,6 @@
 	.mv_insl =	titan_insl,
 	.mv_outsl =	titan_outsl,
 
-	.mv_ioremap =	titan_ioremap,
 	.mv_ioport_map = titan_ioport_map,
 
 	.mv_init_irq =	init_titan_irq,