aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/Kconfig5
-rw-r--r--arch/sh/boards/Kconfig3
-rw-r--r--arch/sh/include/asm/io.h8
-rw-r--r--arch/sh/include/asm/machvec.h9
-rw-r--r--arch/sh/kernel/Makefile3
-rw-r--r--arch/sh/kernel/io.c22
-rw-r--r--arch/sh/kernel/io_generic.c20
-rw-r--r--arch/sh/kernel/io_trapped.c4
-rw-r--r--arch/sh/kernel/machvec.c17
-rw-r--r--drivers/input/serio/Kconfig3
-rw-r--r--drivers/usb/gadget/m66592-udc.h22
-rw-r--r--drivers/usb/gadget/r8a66597-udc.c4
-rw-r--r--drivers/usb/gadget/r8a66597-udc.h24
-rw-r--r--drivers/usb/host/r8a66597-hcd.c4
-rw-r--r--drivers/usb/host/r8a66597.h26
15 files changed, 99 insertions, 75 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 22d25113d76a..573fca1fbd9b 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -9,7 +9,7 @@ config SUPERH
9 def_bool y 9 def_bool y
10 select EMBEDDED 10 select EMBEDDED
11 select HAVE_CLK 11 select HAVE_CLK
12 select HAVE_IDE 12 select HAVE_IDE if HAS_IOPORT
13 select HAVE_LMB 13 select HAVE_LMB
14 select HAVE_OPROFILE 14 select HAVE_OPROFILE
15 select HAVE_GENERIC_DMA_COHERENT 15 select HAVE_GENERIC_DMA_COHERENT
@@ -174,6 +174,9 @@ config ARCH_HAS_DEFAULT_IDLE
174config ARCH_HAS_CPU_IDLE_WAIT 174config ARCH_HAS_CPU_IDLE_WAIT
175 def_bool y 175 def_bool y
176 176
177config NO_IOPORT
178 bool
179
177config IO_TRAPPED 180config IO_TRAPPED
178 bool 181 bool
179 182
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
index 938e87d51482..07b35ca2f644 100644
--- a/arch/sh/boards/Kconfig
+++ b/arch/sh/boards/Kconfig
@@ -154,6 +154,7 @@ config SH_SDK7786
154 bool "SDK7786" 154 bool "SDK7786"
155 depends on CPU_SUBTYPE_SH7786 155 depends on CPU_SUBTYPE_SH7786
156 select SYS_SUPPORTS_PCI 156 select SYS_SUPPORTS_PCI
157 select NO_IOPORT if !PCI
157 help 158 help
158 Select SDK7786 if configuring for a Renesas Technology Europe 159 Select SDK7786 if configuring for a Renesas Technology Europe
159 SH7786-65nm board. 160 SH7786-65nm board.
@@ -190,6 +191,7 @@ config SH_URQUELL
190 depends on CPU_SUBTYPE_SH7786 191 depends on CPU_SUBTYPE_SH7786
191 select ARCH_REQUIRE_GPIOLIB 192 select ARCH_REQUIRE_GPIOLIB
192 select SYS_SUPPORTS_PCI 193 select SYS_SUPPORTS_PCI
194 select NO_IOPORT if !PCI
193 195
194config SH_MIGOR 196config SH_MIGOR
195 bool "Migo-R" 197 bool "Migo-R"
@@ -286,6 +288,7 @@ config SH_LBOX_RE2
286config SH_X3PROTO 288config SH_X3PROTO
287 bool "SH-X3 Prototype board" 289 bool "SH-X3 Prototype board"
288 depends on CPU_SUBTYPE_SHX3 290 depends on CPU_SUBTYPE_SHX3
291 select NO_IOPORT if !PCI
289 292
290config SH_MAGIC_PANEL_R2 293config SH_MAGIC_PANEL_R2
291 bool "Magic Panel R2" 294 bool "Magic Panel R2"
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index f689554e17c1..b237d525d592 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -39,6 +39,8 @@
39#include <asm/io_generic.h> 39#include <asm/io_generic.h>
40#include <asm/io_trapped.h> 40#include <asm/io_trapped.h>
41 41
42#ifdef CONFIG_HAS_IOPORT
43
42#define inb(p) sh_mv.mv_inb((p)) 44#define inb(p) sh_mv.mv_inb((p))
43#define inw(p) sh_mv.mv_inw((p)) 45#define inw(p) sh_mv.mv_inw((p))
44#define inl(p) sh_mv.mv_inl((p)) 46#define inl(p) sh_mv.mv_inl((p))
@@ -60,6 +62,8 @@
60#define outsw(p,b,c) sh_mv.mv_outsw((p), (b), (c)) 62#define outsw(p,b,c) sh_mv.mv_outsw((p), (b), (c))
61#define outsl(p,b,c) sh_mv.mv_outsl((p), (b), (c)) 63#define outsl(p,b,c) sh_mv.mv_outsl((p), (b), (c))
62 64
65#endif
66
63#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile u8 __force *)(a) = (v)) 67#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile u8 __force *)(a) = (v))
64#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v)) 68#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v))
65#define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v)) 69#define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
@@ -240,6 +244,8 @@ __BUILD_MEMORY_STRING(q, u64)
240 244
241#define IO_SPACE_LIMIT 0xffffffff 245#define IO_SPACE_LIMIT 0xffffffff
242 246
247#ifdef CONFIG_HAS_IOPORT
248
243/* 249/*
244 * This function provides a method for the generic case where a 250 * This function provides a method for the generic case where a
245 * board-specific ioport_map simply needs to return the port + some 251 * board-specific ioport_map simply needs to return the port + some
@@ -255,6 +261,8 @@ static inline void __set_io_port_base(unsigned long pbase)
255 261
256#define __ioport_map(p, n) sh_mv.mv_ioport_map((p), (n)) 262#define __ioport_map(p, n) sh_mv.mv_ioport_map((p), (n))
257 263
264#endif
265
258/* We really want to try and get these to memcpy etc */ 266/* We really want to try and get these to memcpy etc */
259void memcpy_fromio(void *, const volatile void __iomem *, unsigned long); 267void memcpy_fromio(void *, const volatile void __iomem *, unsigned long);
260void memcpy_toio(volatile void __iomem *, const void *, unsigned long); 268void memcpy_toio(volatile void __iomem *, const void *, unsigned long);
diff --git a/arch/sh/include/asm/machvec.h b/arch/sh/include/asm/machvec.h
index bc0218cb72e1..a0b0cf79cf8a 100644
--- a/arch/sh/include/asm/machvec.h
+++ b/arch/sh/include/asm/machvec.h
@@ -19,6 +19,10 @@ struct sh_machine_vector {
19 const char *mv_name; 19 const char *mv_name;
20 int mv_nr_irqs; 20 int mv_nr_irqs;
21 21
22 int (*mv_irq_demux)(int irq);
23 void (*mv_init_irq)(void);
24
25#ifdef CONFIG_HAS_IOPORT
22 u8 (*mv_inb)(unsigned long); 26 u8 (*mv_inb)(unsigned long);
23 u16 (*mv_inw)(unsigned long); 27 u16 (*mv_inw)(unsigned long);
24 u32 (*mv_inl)(unsigned long); 28 u32 (*mv_inl)(unsigned long);
@@ -40,12 +44,9 @@ struct sh_machine_vector {
40 void (*mv_outsw)(unsigned long, const void *src, unsigned long count); 44 void (*mv_outsw)(unsigned long, const void *src, unsigned long count);
41 void (*mv_outsl)(unsigned long, const void *src, unsigned long count); 45 void (*mv_outsl)(unsigned long, const void *src, unsigned long count);
42 46
43 int (*mv_irq_demux)(int irq);
44
45 void (*mv_init_irq)(void);
46
47 void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size); 47 void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size);
48 void (*mv_ioport_unmap)(void __iomem *); 48 void (*mv_ioport_unmap)(void __iomem *);
49#endif
49 50
50 int (*mv_clk_init)(void); 51 int (*mv_clk_init)(void);
51 int (*mv_mode_pins)(void); 52 int (*mv_mode_pins)(void);
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 650b92f00ee5..e25f3c69525d 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -12,7 +12,7 @@ endif
12CFLAGS_REMOVE_return_address.o = -pg 12CFLAGS_REMOVE_return_address.o = -pg
13 13
14obj-y := clkdev.o debugtraps.o dma-nommu.o dumpstack.o \ 14obj-y := clkdev.o debugtraps.o dma-nommu.o dumpstack.o \
15 idle.o io.o io_generic.o irq.o \ 15 idle.o io.o irq.o \
16 irq_$(BITS).o machvec.o nmi_debug.o process.o \ 16 irq_$(BITS).o machvec.o nmi_debug.o process.o \
17 process_$(BITS).o ptrace_$(BITS).o \ 17 process_$(BITS).o ptrace_$(BITS).o \
18 reboot.o return_address.o \ 18 reboot.o return_address.o \
@@ -39,6 +39,7 @@ obj-$(CONFIG_DUMP_CODE) += disassemble.o
39obj-$(CONFIG_HIBERNATION) += swsusp.o 39obj-$(CONFIG_HIBERNATION) += swsusp.o
40obj-$(CONFIG_DWARF_UNWINDER) += dwarf.o 40obj-$(CONFIG_DWARF_UNWINDER) += dwarf.o
41obj-$(CONFIG_PERF_EVENTS) += perf_event.o perf_callchain.o 41obj-$(CONFIG_PERF_EVENTS) += perf_event.o perf_callchain.o
42obj-$(CONFIG_HAS_IOPORT) += io_generic.o
42 43
43obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 44obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
44obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += localtimer.o 45obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += localtimer.o
diff --git a/arch/sh/kernel/io.c b/arch/sh/kernel/io.c
index 4770c241c679..5c51b794ba2a 100644
--- a/arch/sh/kernel/io.c
+++ b/arch/sh/kernel/io.c
@@ -112,25 +112,3 @@ void memset_io(volatile void __iomem *dst, int c, unsigned long count)
112 } 112 }
113} 113}
114EXPORT_SYMBOL(memset_io); 114EXPORT_SYMBOL(memset_io);
115
116#ifndef CONFIG_GENERIC_IOMAP
117
118void __iomem *ioport_map(unsigned long port, unsigned int nr)
119{
120 void __iomem *ret;
121
122 ret = __ioport_map_trapped(port, nr);
123 if (ret)
124 return ret;
125
126 return __ioport_map(port, nr);
127}
128EXPORT_SYMBOL(ioport_map);
129
130void ioport_unmap(void __iomem *addr)
131{
132 sh_mv.mv_ioport_unmap(addr);
133}
134EXPORT_SYMBOL(ioport_unmap);
135
136#endif /* CONFIG_GENERIC_IOMAP */
diff --git a/arch/sh/kernel/io_generic.c b/arch/sh/kernel/io_generic.c
index e1e1dbd19557..447d78f666f9 100644
--- a/arch/sh/kernel/io_generic.c
+++ b/arch/sh/kernel/io_generic.c
@@ -158,3 +158,23 @@ void __iomem *generic_ioport_map(unsigned long addr, unsigned int size)
158void generic_ioport_unmap(void __iomem *addr) 158void generic_ioport_unmap(void __iomem *addr)
159{ 159{
160} 160}
161
162#ifndef CONFIG_GENERIC_IOMAP
163void __iomem *ioport_map(unsigned long port, unsigned int nr)
164{
165 void __iomem *ret;
166
167 ret = __ioport_map_trapped(port, nr);
168 if (ret)
169 return ret;
170
171 return __ioport_map(port, nr);
172}
173EXPORT_SYMBOL(ioport_map);
174
175void ioport_unmap(void __iomem *addr)
176{
177 sh_mv.mv_ioport_unmap(addr);
178}
179EXPORT_SYMBOL(ioport_unmap);
180#endif /* CONFIG_GENERIC_IOMAP */
diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c
index 4a8bb4eeb8ad..2947d2bd1291 100644
--- a/arch/sh/kernel/io_trapped.c
+++ b/arch/sh/kernel/io_trapped.c
@@ -91,10 +91,14 @@ int register_trapped_io(struct trapped_io *tiop)
91 tiop->magic = IO_TRAPPED_MAGIC; 91 tiop->magic = IO_TRAPPED_MAGIC;
92 INIT_LIST_HEAD(&tiop->list); 92 INIT_LIST_HEAD(&tiop->list);
93 spin_lock_irq(&trapped_lock); 93 spin_lock_irq(&trapped_lock);
94#ifdef CONFIG_HAS_IOPORT
94 if (flags & IORESOURCE_IO) 95 if (flags & IORESOURCE_IO)
95 list_add(&tiop->list, &trapped_io); 96 list_add(&tiop->list, &trapped_io);
97#endif
98#ifdef CONFIG_HAS_IOMEM
96 if (flags & IORESOURCE_MEM) 99 if (flags & IORESOURCE_MEM)
97 list_add(&tiop->list, &trapped_mem); 100 list_add(&tiop->list, &trapped_mem);
101#endif
98 spin_unlock_irq(&trapped_lock); 102 spin_unlock_irq(&trapped_lock);
99 103
100 return 0; 104 return 0;
diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c
index 85cfaf916fdc..9f9bb63616ad 100644
--- a/arch/sh/kernel/machvec.c
+++ b/arch/sh/kernel/machvec.c
@@ -118,6 +118,14 @@ void __init sh_mv_setup(void)
118 sh_mv.mv_##elem = generic_##elem; \ 118 sh_mv.mv_##elem = generic_##elem; \
119} while (0) 119} while (0)
120 120
121#ifdef CONFIG_HAS_IOPORT
122
123#ifdef P2SEG
124 __set_io_port_base(P2SEG);
125#else
126 __set_io_port_base(0);
127#endif
128
121 mv_set(inb); mv_set(inw); mv_set(inl); 129 mv_set(inb); mv_set(inw); mv_set(inl);
122 mv_set(outb); mv_set(outw); mv_set(outl); 130 mv_set(outb); mv_set(outw); mv_set(outl);
123 131
@@ -129,16 +137,13 @@ void __init sh_mv_setup(void)
129 137
130 mv_set(ioport_map); 138 mv_set(ioport_map);
131 mv_set(ioport_unmap); 139 mv_set(ioport_unmap);
140
141#endif
142
132 mv_set(irq_demux); 143 mv_set(irq_demux);
133 mv_set(mode_pins); 144 mv_set(mode_pins);
134 mv_set(mem_init); 145 mv_set(mem_init);
135 146
136 if (!sh_mv.mv_nr_irqs) 147 if (!sh_mv.mv_nr_irqs)
137 sh_mv.mv_nr_irqs = NR_IRQS; 148 sh_mv.mv_nr_irqs = NR_IRQS;
138
139#ifdef P2SEG
140 __set_io_port_base(P2SEG);
141#else
142 __set_io_port_base(0);
143#endif
144} 149}
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index f34f1dbeb577..3bfe8fafc6ad 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -21,7 +21,8 @@ if SERIO
21config SERIO_I8042 21config SERIO_I8042
22 tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 22 tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86
23 default y 23 default y
24 depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && !M68K && !BLACKFIN 24 depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && \
25 (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN
25 help 26 help
26 i8042 is the chip over which the standard AT keyboard and PS/2 27 i8042 is the chip over which the standard AT keyboard and PS/2
27 mouse are connected to the computer. If you use these devices, 28 mouse are connected to the computer. If you use these devices,
diff --git a/drivers/usb/gadget/m66592-udc.h b/drivers/usb/gadget/m66592-udc.h
index 8b960deed680..c3caf1ac73ce 100644
--- a/drivers/usb/gadget/m66592-udc.h
+++ b/drivers/usb/gadget/m66592-udc.h
@@ -537,35 +537,35 @@ struct m66592 {
537/*-------------------------------------------------------------------------*/ 537/*-------------------------------------------------------------------------*/
538static inline u16 m66592_read(struct m66592 *m66592, unsigned long offset) 538static inline u16 m66592_read(struct m66592 *m66592, unsigned long offset)
539{ 539{
540 return inw((unsigned long)m66592->reg + offset); 540 return ioread16(m66592->reg + offset);
541} 541}
542 542
543static inline void m66592_read_fifo(struct m66592 *m66592, 543static inline void m66592_read_fifo(struct m66592 *m66592,
544 unsigned long offset, 544 unsigned long offset,
545 void *buf, unsigned long len) 545 void *buf, unsigned long len)
546{ 546{
547 unsigned long fifoaddr = (unsigned long)m66592->reg + offset; 547 void __iomem *fifoaddr = m66592->reg + offset;
548 548
549 if (m66592->pdata->on_chip) { 549 if (m66592->pdata->on_chip) {
550 len = (len + 3) / 4; 550 len = (len + 3) / 4;
551 insl(fifoaddr, buf, len); 551 ioread32_rep(fifoaddr, buf, len);
552 } else { 552 } else {
553 len = (len + 1) / 2; 553 len = (len + 1) / 2;
554 insw(fifoaddr, buf, len); 554 ioread16_rep(fifoaddr, buf, len);
555 } 555 }
556} 556}
557 557
558static inline void m66592_write(struct m66592 *m66592, u16 val, 558static inline void m66592_write(struct m66592 *m66592, u16 val,
559 unsigned long offset) 559 unsigned long offset)
560{ 560{
561 outw(val, (unsigned long)m66592->reg + offset); 561 iowrite16(val, m66592->reg + offset);
562} 562}
563 563
564static inline void m66592_write_fifo(struct m66592 *m66592, 564static inline void m66592_write_fifo(struct m66592 *m66592,
565 unsigned long offset, 565 unsigned long offset,
566 void *buf, unsigned long len) 566 void *buf, unsigned long len)
567{ 567{
568 unsigned long fifoaddr = (unsigned long)m66592->reg + offset; 568 void __iomem *fifoaddr = m66592->reg + offset;
569 569
570 if (m66592->pdata->on_chip) { 570 if (m66592->pdata->on_chip) {
571 unsigned long count; 571 unsigned long count;
@@ -573,25 +573,25 @@ static inline void m66592_write_fifo(struct m66592 *m66592,
573 int i; 573 int i;
574 574
575 count = len / 4; 575 count = len / 4;
576 outsl(fifoaddr, buf, count); 576 iowrite32_rep(fifoaddr, buf, count);
577 577
578 if (len & 0x00000003) { 578 if (len & 0x00000003) {
579 pb = buf + count * 4; 579 pb = buf + count * 4;
580 for (i = 0; i < (len & 0x00000003); i++) { 580 for (i = 0; i < (len & 0x00000003); i++) {
581 if (m66592_read(m66592, M66592_CFBCFG)) /* le */ 581 if (m66592_read(m66592, M66592_CFBCFG)) /* le */
582 outb(pb[i], fifoaddr + (3 - i)); 582 iowrite8(pb[i], fifoaddr + (3 - i));
583 else 583 else
584 outb(pb[i], fifoaddr + i); 584 iowrite8(pb[i], fifoaddr + i);
585 } 585 }
586 } 586 }
587 } else { 587 } else {
588 unsigned long odd = len & 0x0001; 588 unsigned long odd = len & 0x0001;
589 589
590 len = len / 2; 590 len = len / 2;
591 outsw(fifoaddr, buf, len); 591 iowrite16_rep(fifoaddr, buf, len);
592 if (odd) { 592 if (odd) {
593 unsigned char *p = buf + len*2; 593 unsigned char *p = buf + len*2;
594 outb(*p, fifoaddr); 594 iowrite8(*p, fifoaddr);
595 } 595 }
596 } 596 }
597} 597}
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 888d8f166c0b..70a817842755 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1500,7 +1500,7 @@ static int __exit r8a66597_remove(struct platform_device *pdev)
1500 struct r8a66597 *r8a66597 = dev_get_drvdata(&pdev->dev); 1500 struct r8a66597 *r8a66597 = dev_get_drvdata(&pdev->dev);
1501 1501
1502 del_timer_sync(&r8a66597->timer); 1502 del_timer_sync(&r8a66597->timer);
1503 iounmap((void *)r8a66597->reg); 1503 iounmap(r8a66597->reg);
1504 free_irq(platform_get_irq(pdev, 0), r8a66597); 1504 free_irq(platform_get_irq(pdev, 0), r8a66597);
1505 r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req); 1505 r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req);
1506#ifdef CONFIG_HAVE_CLK 1506#ifdef CONFIG_HAVE_CLK
@@ -1578,7 +1578,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
1578 init_timer(&r8a66597->timer); 1578 init_timer(&r8a66597->timer);
1579 r8a66597->timer.function = r8a66597_timer; 1579 r8a66597->timer.function = r8a66597_timer;
1580 r8a66597->timer.data = (unsigned long)r8a66597; 1580 r8a66597->timer.data = (unsigned long)r8a66597;
1581 r8a66597->reg = (unsigned long)reg; 1581 r8a66597->reg = reg;
1582 1582
1583#ifdef CONFIG_HAVE_CLK 1583#ifdef CONFIG_HAVE_CLK
1584 if (r8a66597->pdata->on_chip) { 1584 if (r8a66597->pdata->on_chip) {
diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h
index 9a537aa07968..f763b5190afa 100644
--- a/drivers/usb/gadget/r8a66597-udc.h
+++ b/drivers/usb/gadget/r8a66597-udc.h
@@ -91,7 +91,7 @@ struct r8a66597_ep {
91 91
92struct r8a66597 { 92struct r8a66597 {
93 spinlock_t lock; 93 spinlock_t lock;
94 unsigned long reg; 94 void __iomem *reg;
95 95
96#ifdef CONFIG_HAVE_CLK 96#ifdef CONFIG_HAVE_CLK
97 struct clk *clk; 97 struct clk *clk;
@@ -127,7 +127,7 @@ struct r8a66597 {
127 127
128static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) 128static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset)
129{ 129{
130 return inw(r8a66597->reg + offset); 130 return ioread16(r8a66597->reg + offset);
131} 131}
132 132
133static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, 133static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597,
@@ -135,7 +135,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597,
135 unsigned char *buf, 135 unsigned char *buf,
136 int len) 136 int len)
137{ 137{
138 unsigned long fifoaddr = r8a66597->reg + offset; 138 void __iomem *fifoaddr = r8a66597->reg + offset;
139 unsigned int data; 139 unsigned int data;
140 int i; 140 int i;
141 141
@@ -144,7 +144,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597,
144 144
145 /* aligned buf case */ 145 /* aligned buf case */
146 if (len >= 4 && !((unsigned long)buf & 0x03)) { 146 if (len >= 4 && !((unsigned long)buf & 0x03)) {
147 insl(fifoaddr, buf, len / 4); 147 ioread32_rep(fifoaddr, buf, len / 4);
148 buf += len & ~0x03; 148 buf += len & ~0x03;
149 len &= 0x03; 149 len &= 0x03;
150 } 150 }
@@ -152,7 +152,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597,
152 /* unaligned buf case */ 152 /* unaligned buf case */
153 for (i = 0; i < len; i++) { 153 for (i = 0; i < len; i++) {
154 if (!(i & 0x03)) 154 if (!(i & 0x03))
155 data = inl(fifoaddr); 155 data = ioread32(fifoaddr);
156 156
157 buf[i] = (data >> ((i & 0x03) * 8)) & 0xff; 157 buf[i] = (data >> ((i & 0x03) * 8)) & 0xff;
158 } 158 }
@@ -161,7 +161,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597,
161 161
162 /* aligned buf case */ 162 /* aligned buf case */
163 if (len >= 2 && !((unsigned long)buf & 0x01)) { 163 if (len >= 2 && !((unsigned long)buf & 0x01)) {
164 insw(fifoaddr, buf, len / 2); 164 ioread16_rep(fifoaddr, buf, len / 2);
165 buf += len & ~0x01; 165 buf += len & ~0x01;
166 len &= 0x01; 166 len &= 0x01;
167 } 167 }
@@ -169,7 +169,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597,
169 /* unaligned buf case */ 169 /* unaligned buf case */
170 for (i = 0; i < len; i++) { 170 for (i = 0; i < len; i++) {
171 if (!(i & 0x01)) 171 if (!(i & 0x01))
172 data = inw(fifoaddr); 172 data = ioread16(fifoaddr);
173 173
174 buf[i] = (data >> ((i & 0x01) * 8)) & 0xff; 174 buf[i] = (data >> ((i & 0x01) * 8)) & 0xff;
175 } 175 }
@@ -179,7 +179,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597,
179static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, 179static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val,
180 unsigned long offset) 180 unsigned long offset)
181{ 181{
182 outw(val, r8a66597->reg + offset); 182 iowrite16(val, r8a66597->reg + offset);
183} 183}
184 184
185static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, 185static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597,
@@ -187,21 +187,21 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597,
187 unsigned char *buf, 187 unsigned char *buf,
188 int len) 188 int len)
189{ 189{
190 unsigned long fifoaddr = r8a66597->reg + offset; 190 void __iomem *fifoaddr = r8a66597->reg + offset;
191 int adj = 0; 191 int adj = 0;
192 int i; 192 int i;
193 193
194 if (r8a66597->pdata->on_chip) { 194 if (r8a66597->pdata->on_chip) {
195 /* 32-bit access only if buf is 32-bit aligned */ 195 /* 32-bit access only if buf is 32-bit aligned */
196 if (len >= 4 && !((unsigned long)buf & 0x03)) { 196 if (len >= 4 && !((unsigned long)buf & 0x03)) {
197 outsl(fifoaddr, buf, len / 4); 197 iowrite32_rep(fifoaddr, buf, len / 4);
198 buf += len & ~0x03; 198 buf += len & ~0x03;
199 len &= 0x03; 199 len &= 0x03;
200 } 200 }
201 } else { 201 } else {
202 /* 16-bit access only if buf is 16-bit aligned */ 202 /* 16-bit access only if buf is 16-bit aligned */
203 if (len >= 2 && !((unsigned long)buf & 0x01)) { 203 if (len >= 2 && !((unsigned long)buf & 0x01)) {
204 outsw(fifoaddr, buf, len / 2); 204 iowrite16_rep(fifoaddr, buf, len / 2);
205 buf += len & ~0x01; 205 buf += len & ~0x01;
206 len &= 0x01; 206 len &= 0x01;
207 } 207 }
@@ -216,7 +216,7 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597,
216 } 216 }
217 217
218 for (i = 0; i < len; i++) 218 for (i = 0; i < len; i++)
219 outb(buf[i], fifoaddr + adj - (i & adj)); 219 iowrite8(buf[i], fifoaddr + adj - (i & adj));
220} 220}
221 221
222static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, 222static inline void r8a66597_mdfy(struct r8a66597 *r8a66597,
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 6db57ab6079d..1a2bb4ce638f 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -2404,7 +2404,7 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev)
2404 2404
2405 del_timer_sync(&r8a66597->rh_timer); 2405 del_timer_sync(&r8a66597->rh_timer);
2406 usb_remove_hcd(hcd); 2406 usb_remove_hcd(hcd);
2407 iounmap((void *)r8a66597->reg); 2407 iounmap(r8a66597->reg);
2408#ifdef CONFIG_HAVE_CLK 2408#ifdef CONFIG_HAVE_CLK
2409 if (r8a66597->pdata->on_chip) 2409 if (r8a66597->pdata->on_chip)
2410 clk_put(r8a66597->clk); 2410 clk_put(r8a66597->clk);
@@ -2496,7 +2496,7 @@ static int __devinit r8a66597_probe(struct platform_device *pdev)
2496 init_timer(&r8a66597->rh_timer); 2496 init_timer(&r8a66597->rh_timer);
2497 r8a66597->rh_timer.function = r8a66597_timer; 2497 r8a66597->rh_timer.function = r8a66597_timer;
2498 r8a66597->rh_timer.data = (unsigned long)r8a66597; 2498 r8a66597->rh_timer.data = (unsigned long)r8a66597;
2499 r8a66597->reg = (unsigned long)reg; 2499 r8a66597->reg = reg;
2500 2500
2501 /* make sure no interrupts are pending */ 2501 /* make sure no interrupts are pending */
2502 ret = r8a66597_clock_enable(r8a66597); 2502 ret = r8a66597_clock_enable(r8a66597);
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h
index 228e3fb23854..95d0f5adfdcf 100644
--- a/drivers/usb/host/r8a66597.h
+++ b/drivers/usb/host/r8a66597.h
@@ -112,7 +112,7 @@ struct r8a66597_root_hub {
112 112
113struct r8a66597 { 113struct r8a66597 {
114 spinlock_t lock; 114 spinlock_t lock;
115 unsigned long reg; 115 void __iomem *reg;
116#ifdef CONFIG_HAVE_CLK 116#ifdef CONFIG_HAVE_CLK
117 struct clk *clk; 117 struct clk *clk;
118#endif 118#endif
@@ -170,67 +170,67 @@ static inline struct urb *r8a66597_get_urb(struct r8a66597 *r8a66597,
170 170
171static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) 171static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset)
172{ 172{
173 return inw(r8a66597->reg + offset); 173 return ioread16(r8a66597->reg + offset);
174} 174}
175 175
176static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, 176static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597,
177 unsigned long offset, u16 *buf, 177 unsigned long offset, u16 *buf,
178 int len) 178 int len)
179{ 179{
180 unsigned long fifoaddr = r8a66597->reg + offset; 180 void __iomem *fifoaddr = r8a66597->reg + offset;
181 unsigned long count; 181 unsigned long count;
182 182
183 if (r8a66597->pdata->on_chip) { 183 if (r8a66597->pdata->on_chip) {
184 count = len / 4; 184 count = len / 4;
185 insl(fifoaddr, buf, count); 185 ioread32_rep(fifoaddr, buf, count);
186 186
187 if (len & 0x00000003) { 187 if (len & 0x00000003) {
188 unsigned long tmp = inl(fifoaddr); 188 unsigned long tmp = ioread32(fifoaddr);
189 memcpy((unsigned char *)buf + count * 4, &tmp, 189 memcpy((unsigned char *)buf + count * 4, &tmp,
190 len & 0x03); 190 len & 0x03);
191 } 191 }
192 } else { 192 } else {
193 len = (len + 1) / 2; 193 len = (len + 1) / 2;
194 insw(fifoaddr, buf, len); 194 ioread16_rep(fifoaddr, buf, len);
195 } 195 }
196} 196}
197 197
198static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, 198static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val,
199 unsigned long offset) 199 unsigned long offset)
200{ 200{
201 outw(val, r8a66597->reg + offset); 201 iowrite16(val, r8a66597->reg + offset);
202} 202}
203 203
204static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, 204static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597,
205 unsigned long offset, u16 *buf, 205 unsigned long offset, u16 *buf,
206 int len) 206 int len)
207{ 207{
208 unsigned long fifoaddr = r8a66597->reg + offset; 208 void __iomem *fifoaddr = r8a66597->reg + offset;
209 unsigned long count; 209 unsigned long count;
210 unsigned char *pb; 210 unsigned char *pb;
211 int i; 211 int i;
212 212
213 if (r8a66597->pdata->on_chip) { 213 if (r8a66597->pdata->on_chip) {
214 count = len / 4; 214 count = len / 4;
215 outsl(fifoaddr, buf, count); 215 iowrite32_rep(fifoaddr, buf, count);
216 216
217 if (len & 0x00000003) { 217 if (len & 0x00000003) {
218 pb = (unsigned char *)buf + count * 4; 218 pb = (unsigned char *)buf + count * 4;
219 for (i = 0; i < (len & 0x00000003); i++) { 219 for (i = 0; i < (len & 0x00000003); i++) {
220 if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND) 220 if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND)
221 outb(pb[i], fifoaddr + i); 221 iowrite8(pb[i], fifoaddr + i);
222 else 222 else
223 outb(pb[i], fifoaddr + 3 - i); 223 iowrite8(pb[i], fifoaddr + 3 - i);
224 } 224 }
225 } 225 }
226 } else { 226 } else {
227 int odd = len & 0x0001; 227 int odd = len & 0x0001;
228 228
229 len = len / 2; 229 len = len / 2;
230 outsw(fifoaddr, buf, len); 230 ioread16_rep(fifoaddr, buf, len);
231 if (unlikely(odd)) { 231 if (unlikely(odd)) {
232 buf = &buf[len]; 232 buf = &buf[len];
233 outb((unsigned char)*buf, fifoaddr); 233 iowrite8((unsigned char)*buf, fifoaddr);
234 } 234 }
235 } 235 }
236} 236}