git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git]
/
arch
/
sh
/
kernel
/
io_generic.c
diff --git
a/arch/sh/kernel/io_generic.c
b/arch/sh/kernel/io_generic.c
index
a911b01
..
28ec748
100644
(file)
--- a/
arch/sh/kernel/io_generic.c
+++ b/
arch/sh/kernel/io_generic.c
@@
-3,6
+3,7
@@
* linux/arch/sh/kernel/io_generic.c
*
* Copyright (C) 2000 Niibe Yutaka
* linux/arch/sh/kernel/io_generic.c
*
* Copyright (C) 2000 Niibe Yutaka
+ * Copyright (C) 2005 Paul Mundt
*
* Generic I/O routine. These can be used where a machine specific version
* is not required.
*
* Generic I/O routine. These can be used where a machine specific version
* is not required.
@@
-10,21
+11,20
@@
* 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.
* 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/module.h>
#include <asm/io.h>
#include <asm/machvec.h>
#include <asm/io.h>
#include <asm/machvec.h>
-#include <linux/module.h>
-#if defined(CONFIG_CPU_SH3)
+#ifdef CONFIG_CPU_SH3
+/* SH3 has a PCMCIA bug that needs a dummy read from area 6 for a
+ * workaround. */
/* I'm not sure SH7709 has this kind of bug */
/* I'm not sure SH7709 has this kind of bug */
-#define SH3_PCMCIA_BUG_WORKAROUND 1
-#define DUMMY_READ_AREA6 0xba000000
+#define dummy_read() ctrl_inb(0xba000000)
+#else
+#define dummy_read()
#endif
#endif
-#define PORT2ADDR(x) (sh_mv.mv_isa_port2addr(x))
-
unsigned long generic_io_base;
static inline void delay(void)
unsigned long generic_io_base;
static inline void delay(void)
@@
-32,40
+32,40
@@
static inline void delay(void)
ctrl_inw(0xa0000000);
}
ctrl_inw(0xa0000000);
}
-u
nsigned char
generic_inb(unsigned long port)
+u
8
generic_inb(unsigned long port)
{
{
- return
*(volatile unsigned char*)PORT2ADDR(port
);
+ return
ctrl_inb((unsigned long __force)ioport_map(port, 1)
);
}
}
-u
nsigned short
generic_inw(unsigned long port)
+u
16
generic_inw(unsigned long port)
{
{
- return
*(volatile unsigned short*)PORT2ADDR(port
);
+ return
ctrl_inw((unsigned long __force)ioport_map(port, 2)
);
}
}
-u
nsigned int
generic_inl(unsigned long port)
+u
32
generic_inl(unsigned long port)
{
{
- return
*(volatile unsigned long*)PORT2ADDR(port
);
+ return
ctrl_inl((unsigned long __force)ioport_map(port, 4)
);
}
}
-u
nsigned char
generic_inb_p(unsigned long port)
+u
8
generic_inb_p(unsigned long port)
{
{
- unsigned long v =
*(volatile unsigned char*)PORT2ADDR
(port);
+ unsigned long v =
generic_inb
(port);
delay();
return v;
}
delay();
return v;
}
-u
nsigned short
generic_inw_p(unsigned long port)
+u
16
generic_inw_p(unsigned long port)
{
{
- unsigned long v =
*(volatile unsigned short*)PORT2ADDR
(port);
+ unsigned long v =
generic_inw
(port);
delay();
return v;
}
delay();
return v;
}
-u
nsigned int
generic_inl_p(unsigned long port)
+u
32
generic_inl_p(unsigned long port)
{
{
- unsigned long v =
*(volatile unsigned long*)PORT2ADDR
(port);
+ unsigned long v =
generic_inl
(port);
delay();
return v;
delay();
return v;
@@
-77,75
+77,70
@@
unsigned int generic_inl_p(unsigned long port)
* convert the port address to real address once.
*/
* convert the port address to real address once.
*/
-void generic_insb(unsigned long port, void *
buffer
, unsigned long count)
+void generic_insb(unsigned long port, void *
dst
, unsigned long count)
{
{
- volatile unsigned char *port_addr;
- unsigned char *buf=buffer;
-
- port_addr = (volatile unsigned char *)PORT2ADDR(port);
+ volatile u8 *port_addr;
+ u8 *buf = dst;
- while(count--)
- *buf++ = *port_addr;
+ port_addr = (volatile u8 *)ioport_map(port, 1);
+ while (count--)
+ *buf++ = *port_addr;
}
}
-void generic_insw(unsigned long port, void *
buffer
, unsigned long count)
+void generic_insw(unsigned long port, void *
dst
, unsigned long count)
{
{
- volatile u
nsigned short
*port_addr;
- u
nsigned short *buf=buffer
;
+ volatile u
16
*port_addr;
+ u
16 *buf = dst
;
- port_addr = (volatile unsigned short *)PORT2ADDR(port);
+ port_addr = (volatile u16 *)ioport_map(port, 2);
+ while (count--)
+ *buf++ = *port_addr;
- while(count--)
- *buf++ = *port_addr;
-#ifdef SH3_PCMCIA_BUG_WORKAROUND
- ctrl_inb (DUMMY_READ_AREA6);
-#endif
+ dummy_read();
}
}
-void generic_insl(unsigned long port, void *
buffer
, unsigned long count)
+void generic_insl(unsigned long port, void *
dst
, unsigned long count)
{
{
- volatile u
nsigned long
*port_addr;
- u
nsigned long *buf=buffer
;
+ volatile u
32
*port_addr;
+ u
32 *buf = dst
;
- port_addr = (volatile unsigned long *)PORT2ADDR(port);
+ port_addr = (volatile u32 *)ioport_map(port, 4);
+ while (count--)
+ *buf++ = *port_addr;
- while(count--)
- *buf++ = *port_addr;
-#ifdef SH3_PCMCIA_BUG_WORKAROUND
- ctrl_inb (DUMMY_READ_AREA6);
-#endif
+ dummy_read();
}
}
-void generic_outb(u
nsigned char
b, unsigned long port)
+void generic_outb(u
8
b, unsigned long port)
{
{
-
*(volatile unsigned char*)PORT2ADDR(port) = b
;
+
ctrl_outb(b, (unsigned long __force)ioport_map(port, 1))
;
}
}
-void generic_outw(u
nsigned short
b, unsigned long port)
+void generic_outw(u
16
b, unsigned long port)
{
{
-
*(volatile unsigned short*)PORT2ADDR(port) = b
;
+
ctrl_outw(b, (unsigned long __force)ioport_map(port, 2))
;
}
}
-void generic_outl(u
nsigned int
b, unsigned long port)
+void generic_outl(u
32
b, unsigned long port)
{
{
-
*(volatile unsigned long*)PORT2ADDR(port) = b
;
+
ctrl_outl(b, (unsigned long __force)ioport_map(port, 4))
;
}
}
-void generic_outb_p(u
nsigned char
b, unsigned long port)
+void generic_outb_p(u
8
b, unsigned long port)
{
{
-
*(volatile unsigned char*)PORT2ADDR(port) = b
;
+
generic_outb(b, port)
;
delay();
}
delay();
}
-void generic_outw_p(u
nsigned short
b, unsigned long port)
+void generic_outw_p(u
16
b, unsigned long port)
{
{
-
*(volatile unsigned short*)PORT2ADDR(port) = b
;
+
generic_outw(b, port)
;
delay();
}
delay();
}
-void generic_outl_p(u
nsigned int
b, unsigned long port)
+void generic_outl_p(u
32
b, unsigned long port)
{
{
-
*(volatile unsigned long*)PORT2ADDR(port) = b
;
+
generic_outl(b, port)
;
delay();
}
delay();
}
@@
-154,90
+149,77
@@
void generic_outl_p(unsigned int b, unsigned long port)
* address. However as the port address doesn't change we only need to
* convert the port address to real address once.
*/
* address. However as the port address doesn't change we only need to
* convert the port address to real address once.
*/
-
-void generic_outsb(unsigned long port, const void *buffer, unsigned long count)
+void generic_outsb(unsigned long port, const void *src, unsigned long count)
{
{
- volatile u
nsigned char
*port_addr;
- const u
nsigned char *buf=buffer
;
+ volatile u
8
*port_addr;
+ const u
8 *buf = src
;
- port_addr = (volatile u
nsigned char *)PORT2ADDR(port
);
+ port_addr = (volatile u
8 __force *)ioport_map(port, 1
);
- while(count--)
- *port_addr = *buf++;
+ while
(count--)
+
*port_addr = *buf++;
}
}
-void generic_outsw(unsigned long port, const void *
buffer
, unsigned long count)
+void generic_outsw(unsigned long port, const void *
src
, unsigned long count)
{
{
- volatile u
nsigned short
*port_addr;
- const u
nsigned short *buf=buffer
;
+ volatile u
16
*port_addr;
+ const u
16 *buf = src
;
- port_addr = (volatile u
nsigned short *)PORT2ADDR(port
);
+ port_addr = (volatile u
16 __force *)ioport_map(port, 2
);
- while(count--)
- *port_addr = *buf++;
+ while
(count--)
+
*port_addr = *buf++;
-#ifdef SH3_PCMCIA_BUG_WORKAROUND
- ctrl_inb (DUMMY_READ_AREA6);
-#endif
+ dummy_read();
}
}
-void generic_outsl(unsigned long port, const void *
buffer
, unsigned long count)
+void generic_outsl(unsigned long port, const void *
src
, unsigned long count)
{
{
- volatile u
nsigned long
*port_addr;
- const u
nsigned long *buf=buffer
;
+ volatile u
32
*port_addr;
+ const u
32 *buf = src
;
- port_addr = (volatile unsigned long *)PORT2ADDR(port);
+ port_addr = (volatile u32 __force *)ioport_map(port, 4);
+ while (count--)
+ *port_addr = *buf++;
- while(count--)
- *port_addr = *buf++;
-
-#ifdef SH3_PCMCIA_BUG_WORKAROUND
- ctrl_inb (DUMMY_READ_AREA6);
-#endif
-}
-
-unsigned char generic_readb(unsigned long addr)
-{
- return *(volatile unsigned char*)addr;
+ dummy_read();
}
}
-u
nsigned short generic_readw(unsigned long
addr)
+u
8 generic_readb(void __iomem *
addr)
{
{
- return
*(volatile unsigned short*)addr
;
+ return
ctrl_inb((unsigned long __force)addr)
;
}
}
-u
nsigned int generic_readl(unsigned long
addr)
+u
16 generic_readw(void __iomem *
addr)
{
{
- return
*(volatile unsigned long*)addr
;
+ return
ctrl_inw((unsigned long __force)addr)
;
}
}
-
void generic_writeb(unsigned char b, unsigned long
addr)
+
u32 generic_readl(void __iomem *
addr)
{
{
-
*(volatile unsigned char*)addr = b
;
+
return ctrl_inl((unsigned long __force)addr)
;
}
}
-void generic_write
w(unsigned short b, unsigned long
addr)
+void generic_write
b(u8 b, void __iomem *
addr)
{
{
-
*(volatile unsigned short*)addr = b
;
+
ctrl_outb(b, (unsigned long __force)addr)
;
}
}
-void generic_write
l(unsigned int b, unsigned long
addr)
+void generic_write
w(u16 b, void __iomem *
addr)
{
{
-
*(volatile unsigned long*)addr = b
;
+
ctrl_outw(b, (unsigned long __force)addr)
;
}
}
-void
* generic_ioremap(unsigned long offset, unsigned long size
)
+void
generic_writel(u32 b, void __iomem *addr
)
{
{
-
return (void *) P2SEGADDR(offset
);
+
ctrl_outl(b, (unsigned long __force)addr
);
}
}
-EXPORT_SYMBOL(generic_ioremap);
-void
generic_iounmap(void *addr
)
+void
__iomem *generic_ioport_map(unsigned long addr, unsigned int size
)
{
{
+ return (void __iomem *)(addr + generic_io_base);
}
}
-EXPORT_SYMBOL(generic_iounmap);
-
unsigned long generic_isa_port2addr(unsigned long offset
)
+
void generic_ioport_unmap(void __iomem *addr
)
{
{
- return offset + generic_io_base;
}
}